Given an nΓn binary matrix, find the length of the shortest clear path from top-left to bottom-right (8-directional). Return -1 if no path exists. 0=clear, 1=blocked.
Input: grid=[[0,1],[1,0]] Output: 2 Input: grid=[[0,0,0],[1,1,0],[1,1,0]] Output: 4
Unlock hints progressively β start gentle, go deeper only if needed.
Level 1: Gentle Nudge
A subtle direction
Level 2: Approach
The algorithm to use
Level 3: Detailed
Step-by-step guidance
to save progress and use AI features