Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopgrid-search · recursive-enumeration
The organizer’s problem statement is available at the official source link.
sample trace
Cow Hopscotch: branch over valid jumps
From each square, recursively jump down and right to a different color. The published 4?4 sample has three valid routes from the top-left to the bottom-right.
grid
RRRRRRBRRBBRRRRR
route Count
3routes
| 1,1 | 2,3 | 4,4 |
| 1,1 | 3,2 | 4,4 |
| 1,1 | 3,3 | 4,4 |
start
11
goal
44
- 1
Start at the top-left
The sample starts on R at row 1, column 1. - 2
Branch on color changes
Try each later row and column whose color differs from the current square; the sample?s next squares are the three B cells that can reach the goal. - 3
Count completed routes
Each route ends at (4,4). The three route traces in the diagram give the sample answer 3.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 charsRun output
Run your code to see output.