上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 28 下一页
摘要: 链接:https://leetcode-cn.com/problems/climbing-stairs/ 代码 class Solution { public: int climbStairs(int n) { vector<int> f(n + 1); f[0] = 1, f[1] = 1; fo 阅读全文
posted @ 2020-07-11 10:07 景云ⁿ 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/sqrtx/ 代码 class Solution { public: int mySqrt(int x) { int l = 0, r = x; while (l < r) { int mid = (l + 1ll + r) / 阅读全文
posted @ 2020-07-11 10:03 景云ⁿ 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/text-justification/ 代码 class Solution { public: vector<string> fullJustify(vector<string>& words, int maxWidth) { 阅读全文
posted @ 2020-07-11 09:59 景云ⁿ 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/add-binary/ 代码 class Solution { public: string addBinary(string a, string b) { if (a.size() < b.size()) swap(a, b) 阅读全文
posted @ 2020-07-11 09:38 景云ⁿ 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/plus-one/ 代码 class Solution { public: vector<int> plusOne(vector<int>& digits) { int t = 1; for (int i = digits.si 阅读全文
posted @ 2020-07-08 21:18 景云ⁿ 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/valid-number/submissions/ 代码 class Solution { public: bool isNumber(string s) { int l = 0, r = s.size() - 1; while 阅读全文
posted @ 2020-07-08 21:10 景云ⁿ 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/minimum-path-sum/ 代码 class Solution { public: int minPathSum(vector<vector<int>>& grid) { int n = grid.size(); if 阅读全文
posted @ 2020-07-08 20:43 景云ⁿ 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/unique-paths-ii/ 代码 class Solution { public: int uniquePathsWithObstacles(vector<vector<int>>& o) { int n = o.size 阅读全文
posted @ 2020-07-07 21:12 景云ⁿ 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/unique-paths/ 代码 class Solution { public: int uniquePaths(int m, int n) { vector<vector<int>> f(n, vector<int>(m)) 阅读全文
posted @ 2020-07-07 21:05 景云ⁿ 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/rotate-list/ 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNo 阅读全文
posted @ 2020-07-07 18:14 景云ⁿ 阅读(59) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 28 下一页