摘要: Q:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as1and0respectively in the grid.For example,There is one obstacle in the middle of a 3x3 grid as illustrated below.[ [0,0,0], [0, 阅读全文
posted @ 2013-06-23 21:49 summer_zhou 阅读(191) 评论(0) 推荐(0)
摘要: 动态规划 int uniquePaths(int m, int n) { // Start typing your C/C++ solution below // DO NOT write int main() function if(m==0||n==0) return 0; vector > pathCounts; int i,j; for(i=0;i(n)); for(j=0;j<n;j++) ... 阅读全文
posted @ 2013-06-23 19:29 summer_zhou 阅读(136) 评论(0) 推荐(0)
摘要: 动态规划 //DP int minPathSum(vector > &grid) { // Start typing your C/C++ solution below // DO NOT write int main() function if(grid.size()==0) return 0; int m = grid.size(); int n = grid[0].size(); vector > minSum; in... 阅读全文
posted @ 2013-06-23 17:24 summer_zhou 阅读(195) 评论(0) 推荐(0)