08 2020 档案

摘要:link class Solution { public: #define LL long long const int mod=1E9+7; vector<vector<LL>> table; int numOfWays(vector<int>& nums) { int n=nums.size() 阅读全文
posted @ 2020-08-30 17:10 feibilun 阅读(272) 评论(0) 推荐(0)
摘要:link class Solution { public: int maxNonOverlapping(vector<int>& nums, int target) { unordered_map<int,int> pos; pos[0]=-1; int sum=0; int n=nums.size 阅读全文
posted @ 2020-08-10 10:44 feibilun 阅读(136) 评论(0) 推荐(0)
摘要:link class Solution { public: int longestAwesome(string s) { int n=s.size(); vector<int> dp(1<<10,n); int res=1; dp[0]=-1; int mask=0; for(int i=0;i<n 阅读全文
posted @ 2020-08-10 09:32 feibilun 阅读(155) 评论(0) 推荐(0)
摘要:link 随着i增加,缺失的个数非减,在i处缺失的个数为arr[i]-(i+1).二分找到第一个缺失个数大于等于k的位置left, 则left-1处缺失的个数<k。left-1处缺失的个数为arr[left-1]-left, 还差k-arr[left-1]+left个,则答案是k+left. cla 阅读全文
posted @ 2020-08-09 20:53 feibilun 阅读(130) 评论(0) 推荐(0)
摘要:link class Solution { public: struct TrieNode{ TrieNode* children[26]; int id; TrieNode(){ id=-1; for(int i=0;i<26;i++) children[i]=nullptr; } }; Trie 阅读全文
posted @ 2020-08-06 11:14 feibilun 阅读(60) 评论(0) 推荐(0)
摘要:link prove: @interviewrecipes https://leetcode.com/problems/minimum-swaps-to-arrange-a-binary-grid/discuss/768076/Min-Adjacent-Swaps-to-Sort-the-array 阅读全文
posted @ 2020-08-04 11:05 feibilun 阅读(166) 评论(0) 推荐(0)