摘要: 链接: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) 编辑
摘要: 链接:https://leetcode-cn.com/problems/permutation-sequence/ 代码 class Solution { public: string getPermutation(int n, int k) { string ans; vector<bool> s 阅读全文
posted @ 2020-07-07 18:03 景云ⁿ 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/spiral-matrix-ii/ 代码 class Solution { public: vector<vector<int>> generateMatrix(int n) { vector<vector<int>> ans( 阅读全文
posted @ 2020-07-07 17:29 景云ⁿ 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/length-of-last-word/ 代码 class Solution { public: int lengthOfLastWord(string s) { int ans = 0, last = 0; for (int 阅读全文
posted @ 2020-07-07 17:13 景云ⁿ 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/insert-interval/ 代码 class Solution { public: vector<vector<int>> insert(vector<vector<int>>& a, vector<int>& b) { 阅读全文
posted @ 2020-07-07 17:05 景云ⁿ 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/merge-intervals/ 代码 class Solution { public: vector<vector<int>> merge(vector<vector<int>>& intervals) { vector<ve 阅读全文
posted @ 2020-07-07 09:33 景云ⁿ 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/n-queens-ii/ 代码 class Solution { public: vector<bool> col, dg, udg; int ans, N; int totalNQueens(int n) { N = n; c 阅读全文
posted @ 2020-07-07 09:22 景云ⁿ 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/n-queens/ 代码 class Solution { public: int N; vector<bool> col, dg, udg; vector<vector<string>> ans; vector<string> 阅读全文
posted @ 2020-07-07 09:14 景云ⁿ 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/jump-game-ii/ 代码 class Solution { public: int jump(vector<int>& nums) { int n = nums.size(); vector<int> f(n); for 阅读全文
posted @ 2020-07-07 08:57 景云ⁿ 阅读(50) 评论(0) 推荐(0) 编辑