摘要:
``` class Solution { public: int jump2(vector& nums) { int res = 0, n = nums.size(), last = 0, cur = 0; for (int i = 0; i = n - 1) break; } } return res... 阅读全文
摘要:
``` class Solution { public: bool isMatch(string s, string p) { int m = s.size(), n = p.size(); vector dp(m + 1, vector(n + 1, false)); dp[0][0] = tru 阅读全文
摘要:
``` class Solution { public: string multiply(string num1, string num2) { int n1 = num1.size(), n2 = num2.size(); vector tmpres(n1+n2, 0); int k = n1 + n2 - 2; for(i... 阅读全文
摘要:
class Solution { public: int trap(vector& height) { int l = 0, r = height.size() 1, level = 0, res = 0; while (l 阅读全文
摘要:
``` class Solution { public: int firstMissingPositive(vector& nums) { int n = nums.size(); for (int i = 0; i 0 && nums[i] 阅读全文
摘要:
``` class Solution { public: vector combinationSum2(vector &num, int target) { vector result; vector subsets; vector empty; subsets.push_back(empty); 阅读全文
摘要:
``` class Solution { public: vector combinationSum(vector& candidates, int target) { vector res; combinationSumDFS(candidates, target, 0, {}, res); re 阅读全文
摘要:
``` class Solution { public: string countAndSay(int n) { if (n 阅读全文
摘要:
``` class Solution { public: void solveSudoku(vector &board) { if (board.empty() || board.size() != 9 || board[0].size() != 9) return; solveSudokuDFS( 阅读全文
摘要:
``` class Solution { public: bool isValidSudoku(vector &board) { if (board.empty() || board[0].empty()) return false; int m = board.size(), n = board[ 阅读全文