摘要:
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
阅读(59)
评论(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
阅读(51)
评论(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
阅读(53)
评论(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
阅读(99)
评论(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
阅读(39)
评论(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
阅读(58)
评论(0)
推荐(0)
摘要:
用到hash表+堆 class Solution { public: string reorganizeString(string s) { map<char, int> maps; // 对于偶数n而言,如果出现最多字母个数超过n/2,则肯定有两相邻元素相同。 // 对于奇数而言,如果出现最多字母 阅读全文
posted @ 2021-08-14 15:40
三一一一317
阅读(66)
评论(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
阅读(92)
评论(0)
推荐(0)

浙公网安备 33010602011771号