上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 38 下一页
摘要: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), 阅读全文
posted @ 2020-04-11 19:49 Jinxiaobo0509 阅读(105) 评论(0) 推荐(0)
摘要: 1 //从四个方向比较,只要任意一个方向不满足,就不重叠 2 class Solution 3 { 4 public: 5 int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) 6 { 7 long long 阅读全文
posted @ 2020-04-11 18:17 Jinxiaobo0509 阅读(312) 评论(0) 推荐(0)
摘要: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), 阅读全文
posted @ 2020-04-11 17:32 Jinxiaobo0509 阅读(150) 评论(0) 推荐(0)
摘要: 1 //dp(i, j)=min(dp(i−1, j), dp(i−1, j−1), dp(i, j−1))+1 2 class Solution 3 { 4 public: 5 int maximalSquare(vector<vector<char>>& matrix) 6 { 7 if(mat 阅读全文
posted @ 2020-04-11 16:29 Jinxiaobo0509 阅读(134) 评论(0) 推荐(0)
摘要: 1 //用multimap就可以解决 2 class Solution 3 { 4 public: 5 bool containsNearbyAlmostDuplicate(vector<int>& nums, int k, int t) 6 { 7 if(nums.empty()) return 阅读全文
posted @ 2020-04-11 14:09 Jinxiaobo0509 阅读(138) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 bool containsNearbyDuplicate(vector<int>& nums, int k) 5 { 6 unordered_map<int,int> hash; 7 for(int i = 0;i < nums.si 阅读全文
posted @ 2020-04-10 16:26 Jinxiaobo0509 阅读(118) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 bool containsDuplicate(vector<int>& nums) 5 { 6 unordered_map<int,int> hash; 7 for(auto a : nums) 8 { 9 if(++ hash[a] 阅读全文
posted @ 2020-04-10 16:17 Jinxiaobo0509 阅读(64) 评论(0) 推荐(0)
摘要: 1 // [1,3],[4,7],[9,9] 2 // L[1] = 3,L[4] = 7,L[9] = 9; 3 // R[3] = 1,R[7] = 4,R[9] = 9; 4 class SummaryRanges 5 { 6 map<int,int> L,R; 7 unordered_set 阅读全文
posted @ 2020-04-10 15:15 Jinxiaobo0509 阅读(170) 评论(0) 推荐(0)
摘要: 1 class MedianFinder 2 { 3 priority_queue<int,vector<int>,greater<int>> up;//小根堆 4 priority_queue<int> down;//大根堆 5 public: 6 MedianFinder() {} 7 8 vo 阅读全文
posted @ 2020-04-10 11:08 Jinxiaobo0509 阅读(109) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 struct cmp 4 { 5 bool operator()(pair<string,int> const &left,pair<string,int> const &right) 6 { 7 if(left.second == right.seco 阅读全文
posted @ 2020-04-09 22:21 Jinxiaobo0509 阅读(154) 评论(0) 推荐(0)
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 38 下一页