摘要:
题解 Easy | Backtracking/DFS 这道题被标记为Easy级别,可是我感觉并不简单,还是花了一些时间的。 class Solution { public: vector<string> readBinaryWatch(int num) { set<string> ret; vect 阅读全文
posted @ 2020-09-25 09:49
CasperWin
阅读(73)
评论(0)
推荐(0)
摘要:
题解 Hard | Backtracking/DFS 这道题使用标准的Backtracking套路,不难得解。一开始没有注意两点,导致错误: 起点不一定是在左上角的grid[0][0],而是需要根据条件找出来; 每一个非障碍位置都需要走一次,这就不同于之前的 Unique Paths 的题,有些格子 阅读全文
posted @ 2020-09-25 08:44
CasperWin
阅读(79)
评论(0)
推荐(0)
摘要:
题解 Medium 动态规划 class Solution { public: int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) { if(obstacleGrid.empty()) return 0; int m = o 阅读全文
posted @ 2020-09-25 03:22
CasperWin
阅读(60)
评论(0)
推荐(0)
摘要:
题解 Easy. 动态规划。 class Solution { public: int uniquePaths(int m, int n) { vector<vector<int>> dp(m, vector<int>(n)); for(int i = 0; i < m; i++) dp[i][0] 阅读全文
posted @ 2020-09-25 03:13
CasperWin
阅读(60)
评论(0)
推荐(0)

浙公网安备 33010602011771号