Standard BFS from (0,0) to (n-1, n-1).
Mark cells as visited when added to the queue (not when processed) to avoid adding the same cell multiple times.
Each step explores all 8 directions. First time you reach the destination, return the path length.
If starting or ending cell is 1, return -1 immediately.