摘要:
链接:https://leetcode-cn.com/problems/jump-game/ 代码 class Solution { public: bool canJump(vector<int>& nums) { for (int i = 0, j = 0; i < nums.size(); + 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/spiral-matrix/ 代码 class Solution { public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int> ans; 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/maximum-subarray/ 代码 class Solution { public: int maxSubArray(vector<int>& nums) { int ans = 0, n = nums.size(); v 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/powx-n/ 代码 class Solution { public: #define LL long long double myPow(double x, int n) { double ans = 1, p = x; LL 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/group-anagrams/ 代码 class Solution { public: vector<vector<string>> groupAnagrams(vector<string>& strs) { unordered 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/rotate-image/ 代码 class Solution { public: void rotate(vector<vector<int>>& matrix) { int n = matrix.size(); for (i 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/permutations-ii/ 代码 class Solution { public: vector<vector<int>> ans; vector<int> path; vector<bool> st; vector<ve 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/permutations/ 代码 class Solution { public: vector<vector<int>> ans; vector<int> path; vector<bool> st; vector<vecto 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/wildcard-matching/ 代码 class Solution { public: bool isMatch(string s, string p) { int n = s.size(), m = p.size(); 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/multiply-strings/ 代码 class Solution { public: string multiply(string num1, string num2) { vector<int> A, B; int n 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/trapping-rain-water/ 代码 class Solution { public: int trap(vector<int>& height) { stack<int> stk; int ans = 0; for 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/first-missing-positive/ 代码 class Solution { public: int firstMissingPositive(vector<int>& nums) { int n = nums.siz 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/combination-sum-ii/ 代码(dfs) class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int> 阅读全文
摘要:
链接:https://leetcode-cn.com/problems/combination-sum/ 代码(dfs) class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int>> c 阅读全文