← Back to Games

Border Run Challenge

Trace the boundary of a matrix in clockwise order!

Phase 1
→ Top Row
Phase 2
↓ Right Col
Phase 3
← Bottom Row
Phase 4
↑ Left Col
Moving Right
📤 Boundary Traversal Output
Elements will appear here...
📐 Boundary Traversal Algorithm

1. Top Row →

Traverse from (0, 0) to (0, cols-1)

for c = 0 to cols-1

2. Right Column ↓

Traverse from (1, cols-1) to (rows-1, cols-1)

for r = 1 to rows-1

3. Bottom Row ←

Traverse from (rows-1, cols-2) to (rows-1, 0)

for c = cols-2 to 0

4. Left Column ↑

Traverse from (rows-2, 0) to (1, 0)

for r = rows-2 to 1