• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
村雨sup
自己选的路,跪着也要走完 XD
博客园    首页    新随笔    联系   管理    订阅  订阅
2018年10月9日
Leetcode 63
摘要: //一维dp还是比较难写的class Solution { public: int uniquePathsWithObstacles(vector>& obstacleGrid) { int m = obstacleGrid[0].size(); int n = obstacleGrid.size(); vector dp(m,1); ... 阅读全文
posted @ 2018-10-09 17:04 村雨sup 阅读(123) 评论(0) 推荐(0)
Leetcode 62
摘要: //从理解二维dp到简化成一维dp我用了一年的时间class Solution { public: int uniquePaths(int m, int n) { vector dp(m,1); for(int i=1;i < n;i++){ for(int j=1;j < m;j++){ dp[j]... 阅读全文
posted @ 2018-10-09 16:28 村雨sup 阅读(83) 评论(0) 推荐(0)
Leetcode 61
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *///注意取模,和空集 class Solution { public: L... 阅读全文
posted @ 2018-10-09 15:58 村雨sup 阅读(92) 评论(0) 推荐(0)
Leetcode 58
摘要: class Solution { public: int lengthOfLastWord(string s) { int n = s.size(); int res = 0; int j = 0; for(j=n-1;j >= 0;j--){ if(s[j] != ' ') ... 阅读全文
posted @ 2018-10-09 15:23 村雨sup 阅读(64) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3