摘要: 链接:https://leetcode-cn.com/problems/jump-game/ 代码 class Solution { public: bool canJump(vector<int>& nums) { for (int i = 0, j = 0; i < nums.size(); + 阅读全文
posted @ 2020-07-06 22:03 景云ⁿ 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/spiral-matrix/ 代码 class Solution { public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int> ans; 阅读全文
posted @ 2020-07-06 21:48 景云ⁿ 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/maximum-subarray/ 代码 class Solution { public: int maxSubArray(vector<int>& nums) { int ans = 0, n = nums.size(); v 阅读全文
posted @ 2020-07-06 21:39 景云ⁿ 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 链接: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 阅读全文
posted @ 2020-07-06 21:35 景云ⁿ 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/group-anagrams/ 代码 class Solution { public: vector<vector<string>> groupAnagrams(vector<string>& strs) { unordered 阅读全文
posted @ 2020-07-06 21:30 景云ⁿ 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/rotate-image/ 代码 class Solution { public: void rotate(vector<vector<int>>& matrix) { int n = matrix.size(); for (i 阅读全文
posted @ 2020-07-06 21:12 景云ⁿ 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/permutations-ii/ 代码 class Solution { public: vector<vector<int>> ans; vector<int> path; vector<bool> st; vector<ve 阅读全文
posted @ 2020-07-06 20:36 景云ⁿ 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/permutations/ 代码 class Solution { public: vector<vector<int>> ans; vector<int> path; vector<bool> st; vector<vecto 阅读全文
posted @ 2020-07-06 20:21 景云ⁿ 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/wildcard-matching/ 代码 class Solution { public: bool isMatch(string s, string p) { int n = s.size(), m = p.size(); 阅读全文
posted @ 2020-07-06 17:14 景云ⁿ 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/multiply-strings/ 代码 class Solution { public: string multiply(string num1, string num2) { vector<int> A, B; int n 阅读全文
posted @ 2020-07-06 16:54 景云ⁿ 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/trapping-rain-water/ 代码 class Solution { public: int trap(vector<int>& height) { stack<int> stk; int ans = 0; for 阅读全文
posted @ 2020-07-06 16:26 景云ⁿ 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/first-missing-positive/ 代码 class Solution { public: int firstMissingPositive(vector<int>& nums) { int n = nums.siz 阅读全文
posted @ 2020-07-06 15:44 景云ⁿ 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/combination-sum-ii/ 代码(dfs) class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int> 阅读全文
posted @ 2020-07-06 15:24 景云ⁿ 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 链接:https://leetcode-cn.com/problems/combination-sum/ 代码(dfs) class Solution { public: vector<vector<int>> ans; vector<int> path; vector<vector<int>> c 阅读全文
posted @ 2020-07-06 15:13 景云ⁿ 阅读(45) 评论(0) 推荐(0) 编辑