上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 23 下一页
摘要: 解析: https://www.cnblogs.com/gzshan/p/10904273.html?ivk_sa=1024320u class Solution { public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { d 阅读全文
posted @ 2021-08-15 12:13 三一一一317 阅读(90) 评论(0) 推荐(0)
摘要: class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { vector<int> res; unordered_map<int,int> un_map; for(int i = 0; i < nums.s 阅读全文
posted @ 2021-08-14 19:27 三一一一317 阅读(52) 评论(0) 推荐(0)
摘要: 参考: https://leetcode-cn.com/problems/longest-increasing-subsequence/solution/dong-tai-gui-hua-er-fen-cha-zhao-tan-xin-suan-fa-p/ class Solution { publ 阅读全文
posted @ 2021-08-14 19:13 三一一一317 阅读(40) 评论(0) 推荐(0)
摘要: class Solution { public: int minSubArrayLen(int target, vector<int>& nums) { int maxsize = INT_MAX; int left = 0; int right = 0; int sum = 0; while(ri 阅读全文
posted @ 2021-08-14 18:49 三一一一317 阅读(41) 评论(0) 推荐(0)
摘要: class Solution { public: //vector<vector<int>> res; int res = 0; int count_0 = 0; int uniquePathsIII(vector<vector<int>>& grid) { int m = grid.size(); 阅读全文
posted @ 2021-08-14 18:06 三一一一317 阅读(94) 评论(0) 推荐(0)
摘要: class Solution { public: int nthUglyNumber(int n) { vector<int> res(n,1); int a = 0; int b = 0; int c = 0; for(int i = 1; i < n; i++){ // 定义三个指针分别维护 2 阅读全文
posted @ 2021-08-14 17:13 三一一一317 阅读(36) 评论(0) 推荐(0)
摘要: class Solution { public: int characterReplacement(string s, int k) { unordered_map<char,int> un_map; int left = 0; int res = 0; int maxval = 0; for(in 阅读全文
posted @ 2021-08-14 16:43 三一一一317 阅读(45) 评论(0) 推荐(0)
摘要: 用到hash表+堆 class Solution { public: string reorganizeString(string s) { map<char, int> maps; // 对于偶数n而言,如果出现最多字母个数超过n/2,则肯定有两相邻元素相同。 // 对于奇数而言,如果出现最多字母 阅读全文
posted @ 2021-08-14 15:40 三一一一317 阅读(54) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2021-08-14 00:39 三一一一317 阅读(82) 评论(0) 推荐(0)
摘要: class Solution { public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int> res; int t = 0; int b = matrix.size()-1; int l = 0; int r 阅读全文
posted @ 2021-08-13 20:38 三一一一317 阅读(91) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 23 下一页