摘要:I use a stack. Of course you can simply trace nodes with 9s - https://leetcode.com/discuss/111127/iterative-two-pointers-with-dummy-node-java-o-n-time
阅读全文
06 2016 档案
摘要:A mix of hashmap, list and heap. struct Tw { Tw(long long pts, int tid) { ts = pts; tweetid = tid; } long long ts; int tweetid; }; struct Cmp { bool o
阅读全文
摘要:Hits come and go - so we use queue. Nothing special.
阅读全文
摘要:Very nice DP problem. The key fact of a mutual-divisible subset: if a new number n, is divisible with the largest number m within a mutual-divisible s
阅读全文
摘要:Typical DFS problem. Simply get higher height and push_back.
阅读全文
摘要:Typical binary search.. but take care of data overflow if you are using C++
阅读全文
摘要:Firt thought: an variation to LCS problem - but this one has many tricky detail. I learnt the solution from this link:https://github.com/wangyongliang
阅读全文
摘要:Queue + hashset
阅读全文
摘要:Greedy using priority_queue and hashmap. The basic idea is to have k buckets - and we fill it greedily. And I agree that the code below can be cleaner
阅读全文
摘要:First you find the Y, and then do a pairing game - hashtable is good. class Solution { public: bool isReflected(vector<pair<int, int>>& points) { int
阅读全文
摘要:An intuitive DP - should be 'medium'.
阅读全文
摘要:BFS solution is intuitive - here I will show a DFS based solution:
阅读全文

浙公网安备 33010602011771号