Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Unique Paths III

In a grid, 1 is the start, 2 is the end, 0 is an empty cell that must be walked over and -1 is an obstacle. Print the number of 4-directional paths from the start to the end that visit every non-obstacle cell exactly once.

Constraints

1 <= R * C <= 20

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.