240
笔下虽有千言,胸中实无一策
摘要: 题解 Easy | Hashmap class Solution { public: vector<int> twoSum(vector<int>& numbers, int target) { unordered_map<int, int> m; for(int i = 0; i < number 阅读全文
posted @ 2020-09-29 13:31 CasperWin 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium | Backtracking class Solution { public: vector<vector<int>> subsetsWithDup(vector<int>& nums) { sort(nums.begin(), nums.end()); vector<vecto 阅读全文
posted @ 2020-09-29 12:58 CasperWin 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium | Backtracking class Solution { public: vector<vector<int>> subsets(vector<int>& nums) { sort(nums.begin(), nums.end()); vector<vector<int>> 阅读全文
posted @ 2020-09-29 12:55 CasperWin 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium | Backtracking class Solution { public: int getMaximumGold(vector<vector<int>>& grid) { int ret = 0; for(int i = 0; i < grid.size(); i++) { 阅读全文
posted @ 2020-09-29 12:37 CasperWin 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium | Backtracking class Solution { public: vector<vector<int>> combinationSum3(int k, int n) { vector<vector<int>> sols; vector<int> sol; helpe 阅读全文
posted @ 2020-09-29 12:15 CasperWin 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium | Backtracking class Solution { public: vector<vector<int>> combinationSum2(vector<int>& candidates, int target) { sort(candidates.begin(), 阅读全文
posted @ 2020-09-29 12:08 CasperWin 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium | Backtracking class Solution { public: vector<vector<int>> combinationSum(vector<int>& candidates, int target) { vector<vector<int>> sols; 阅读全文
posted @ 2020-09-29 12:00 CasperWin 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 题解 Medium | Backtracking 经典的排列组合题,使用回溯法。必须熟练。 class Solution { public: vector<vector<int>> combine(int n, int k) { vector<vector<int>> combinations; v 阅读全文
posted @ 2020-09-29 11:49 CasperWin 阅读(65) 评论(0) 推荐(0) 编辑