上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 32 下一页
摘要: ``` class Solution { public: bool isNumber(string s) { bool num = false, numAfterE = true, dot = false, exp = false, sign = false; int n = s.size(); f 阅读全文
posted @ 2019-04-09 10:41 JohnRed 阅读(94) 评论(0) 推荐(0)
摘要: ``` class Solution { public: int minPathSum(vector &grid) { int m = grid.size(), n = grid[0].size(); int dp[m][n]; dp[0][0] = grid[0][0]; for (int i = 阅读全文
posted @ 2019-04-09 10:39 JohnRed 阅读(79) 评论(0) 推荐(0)
摘要: ``` class Solution { public: int uniquePathsWithObstacles(vector & obstacleGrid) { if (obstacleGrid.empty() || obstacleGrid[0].empty() || obstacleGrid 阅读全文
posted @ 2019-04-09 10:38 JohnRed 阅读(74) 评论(0) 推荐(0)
摘要: ``` class Solution { public: int uniquePaths(int m, int n) { vector dp(n, 1); for (int i = 1; i 阅读全文
posted @ 2019-04-09 10:36 JohnRed 阅读(78) 评论(0) 推荐(0)
摘要: ``` class Solution { public: ListNode *rotateRight(ListNode *head, int k) { if (!head) return NULL; int n = 1; ListNode *cur = head; while (cur->next) { ... 阅读全文
posted @ 2019-04-09 10:35 JohnRed 阅读(93) 评论(0) 推荐(0)
摘要: ``` class Solution { public: string getPermutation(int n, int k) { string res; string num = "123456789"; vector f(n, 1); for (int i = 1; i = 1; --i) { i... 阅读全文
posted @ 2019-04-09 10:33 JohnRed 阅读(73) 评论(0) 推荐(0)
摘要: ``` class Solution { public: vector > generateMatrix(int n) { vector > res(n, vector(n, 0)); int val = 1, p = n; for (int i = 0; i = i; --col) res[i + p - 1... 阅读全文
posted @ 2019-04-09 10:31 JohnRed 阅读(86) 评论(0) 推荐(0)
摘要: ``` class Solution { public: int lengthOfLastWord(string s) { int right = s.size() - 1, res = 0; while (right >= 0 && s[right] == ' ') --right; while (right >= 0 && s[right... 阅读全文
posted @ 2019-04-09 10:29 JohnRed 阅读(75) 评论(0) 推荐(0)
摘要: ``` class Solution { public: vector insert(vector& intervals, Interval newInterval) { vector res; int n = intervals.size(), cur = 0; while (cur 阅读全文
posted @ 2019-04-09 10:26 JohnRed 阅读(86) 评论(0) 推荐(0)
摘要: ``` class Solution { public: vector merge(vector& intervals) { if (intervals.empty()) return {}; sort(intervals.begin(), intervals.end(), "" {return a 阅读全文
posted @ 2019-04-09 10:24 JohnRed 阅读(86) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 32 下一页