• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
村雨sup
自己选的路,跪着也要走完 XD
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 42 下一页
2018年10月22日
Leetcode 70
摘要: class Solution { public: int climbStairs(int n) { if(n == 1)return 1; if(n == 2)return 2; int x = 1; int y = 2; while(n-2){ int t = y; ... 阅读全文
posted @ 2018-10-22 20:25 村雨sup 阅读(120) 评论(0) 推荐(0)
2018年10月18日
解决ubuntu登陆失败,"Failed to start session"的问题
摘要: 我是在虚拟机中安装了Ubuntu 14.04 系统,在Ubuntu 中执行 apt-get update 和 apt-get upgrade 命令后,然后重启系统。 但是,在重启成功后,在登陆的界面进行登陆时,却报错误"Failed to start session" ,无法登陆。 Ubuntu 从 阅读全文
posted @ 2018-10-18 23:11 村雨sup 阅读(7013) 评论(0) 推荐(0)
2018年10月11日
Leetcode 67
摘要: // string 转 数字很简单,-‘0’就行,数字转string 要用to_string(),是个比较好的函数,网上用的sprintf之类的都丑哭了。class Solution { public: string addBinary(string a, string b) { int lena = a.size(); int lenb = b.size... 阅读全文
posted @ 2018-10-11 10:20 村雨sup 阅读(119) 评论(0) 推荐(0)
2018年10月10日
Leetcode 66
摘要: //如何再vector头部插一个数class Solution { public: vector plusOne(vector& digits) { int n = digits.size(); int jinwei = 0; digits[n-1] += 1; if(digits[n-1] == 10){ ... 阅读全文
posted @ 2018-10-10 11:23 村雨sup 阅读(105) 评论(0) 推荐(0)
Leetcode 64
摘要: class Solution { public: int minPathSum(vector>& grid) { int n = grid.size(); int m = grid[0].size(); vector> map(n,vector(m,0));//注意二维vector的初始化写法 map[0][0] = gri... 阅读全文
posted @ 2018-10-10 10:22 村雨sup 阅读(108) 评论(0) 推荐(0)
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)
2018年10月8日
Leetcode 55
摘要: //很巧妙的贪心算法 reach = max(reach,nums[i] + i); class Solution { public: bool canJump(vector& nums) { int n = nums.size(); int reach = 0; for(int i=0;i reach || reach >= n-1) ... 阅读全文
posted @ 2018-10-08 16:46 村雨sup 阅读(91) 评论(0) 推荐(0)
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 42 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3