(This question is a variation of the LeetCode question 1091. Shortest Path in Binary Matrix. If you haven't completed that question yet, it is recommended to solve it first.)
You are given an grid where each cell contains a digit, find the shortest path from the top-left corner to the bottom-right corner . A cell with a value from 1 to 9 is walkable, while a cell with a value of 0 represents a wall that cannot be traversed. You can move in all eight possible directions (up, down, left, right, and the four diagonals).
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected