摘要:
链接:https://leetcode-cn.com/problems/unique-paths-ii/ 代码 class Solution { public: int uniquePathsWithObstacles(vector<vector<int>>& o) { int n = o.size 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/unique-paths/ 代码 class Solution { public: int uniquePaths(int m, int n) { vector<vector<int>> f(n, vector<int>(m)) 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/rotate-list/ 代码 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNo 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/permutation-sequence/ 代码 class Solution { public: string getPermutation(int n, int k) { string ans; vector<bool> s 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/spiral-matrix-ii/ 代码 class Solution { public: vector<vector<int>> generateMatrix(int n) { vector<vector<int>> ans( 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/length-of-last-word/ 代码 class Solution { public: int lengthOfLastWord(string s) { int ans = 0, last = 0; for (int 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/insert-interval/ 代码 class Solution { public: vector<vector<int>> insert(vector<vector<int>>& a, vector<int>& b) { 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/merge-intervals/ 代码 class Solution { public: vector<vector<int>> merge(vector<vector<int>>& intervals) { vector<ve 阅读全文
摘要:
链接: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 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/n-queens/ 代码 class Solution { public: int N; vector<bool> col, dg, udg; vector<vector<string>> ans; vector<string> 阅读全文
摘要:
链接: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 阅读全文