Shortest Path in Binary Matrix
https://leetcode.com/problems/shortest-path-in-binary-matrix/ 以下为我的思考过程: 我首先想到能否使用动态规划解题,因为,假设要求解的坐标为(i,j),那么我只需要知道其邻域八个坐标的解,即对于给定任意grid中的坐标,如果该坐标值为0,则我只需使用 1+min(邻域坐标最短路径)即可求解。但细想 …
Archive
https://leetcode.com/problems/shortest-path-in-binary-matrix/ 以下为我的思考过程: 我首先想到能否使用动态规划解题,因为,假设要求解的坐标为(i,j),那么我只需要知道其邻域八个坐标的解,即对于给定任意grid中的坐标,如果该坐标值为0,则我只需使用 1+min(邻域坐标最短路径)即可求解。但细想 …