mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
Update spiral_matrix.py (#511)
* Improve spiral matrix instructions with clearer movement description and hint --------- Co-authored-by: Andreas Koepf <andreas.koepf@provisio.com>
This commit is contained in:
parent
bcc68c5fee
commit
2c4e45d9a9
1 changed files with 6 additions and 4 deletions
|
|
@ -14,12 +14,14 @@ from ..factory import ProceduralDataset, register_dataset
|
||||||
QUESTION_TEMPLATE = """Given a matrix, your job is to generate a list of elements in spiral order, starting from the top-left element.
|
QUESTION_TEMPLATE = """Given a matrix, your job is to generate a list of elements in spiral order, starting from the top-left element.
|
||||||
|
|
||||||
The spiral order is clockwise, starting from the top-left corner. More precisely:
|
The spiral order is clockwise, starting from the top-left corner. More precisely:
|
||||||
- Start from the top-left corner and move right.
|
- Start from the top-left corner and move right along the top row.
|
||||||
- Move down towards the bottom-right corner.
|
- Move down along the right column.
|
||||||
- Move left towards the bottom-left corner.
|
- Move left along the bottom row.
|
||||||
- Move up towards the top-right corner.
|
- Move up along the left column.
|
||||||
- Repeat the steps for the inner elements of the matrix until every entry is visited.
|
- Repeat the steps for the inner elements of the matrix until every entry is visited.
|
||||||
|
|
||||||
|
Hint: Think of peeling the matrix layer by layer from the outside inward. Each layer forms a rectangular frame, and you traverse each frame clockwise starting from its top-left corner.
|
||||||
|
|
||||||
Your output should be a space-separated list of integers, e.g. 1 2 3 4 5 6
|
Your output should be a space-separated list of integers, e.g. 1 2 3 4 5 6
|
||||||
|
|
||||||
For the matrix below, what is the list of elements in spiral order?
|
For the matrix below, what is the list of elements in spiral order?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue