Dsa
Graphs Dfs
Hard
Garden Paths
A garden is represented as a grid, and you are tasked to find all unique paths that visit each cell exactly once. The garden's corners are boundaries, meaning paths must wrap around. Write a program to find all possible unique paths and output their count. The input will consist of dimensions of the grid and will be terminated by 'END'.
Example:
Input:
2 2
END
Output:
2
Key concepts
graphsdfsbacktracking
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now