Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

06 2016 档案

摘要: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 阅读全文
posted @ 2016-06-30 01:53 Tonix 阅读(262) 评论(0) 推荐(0)

摘要: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 阅读全文
posted @ 2016-06-28 01:56 Tonix 阅读(241) 评论(0) 推荐(0)

摘要:Hits come and go - so we use queue. Nothing special. 阅读全文
posted @ 2016-06-28 01:03 Tonix 阅读(183) 评论(0) 推荐(0)

摘要: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 阅读全文
posted @ 2016-06-27 13:20 Tonix 阅读(348) 评论(0) 推荐(0)

摘要:Typical DFS problem. Simply get higher height and push_back. 阅读全文
posted @ 2016-06-27 11:35 Tonix 阅读(169) 评论(0) 推荐(0)

摘要:Typical binary search.. but take care of data overflow if you are using C++ 阅读全文
posted @ 2016-06-27 11:21 Tonix 阅读(190) 评论(0) 推荐(0)

摘要: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 阅读全文
posted @ 2016-06-18 09:09 Tonix 阅读(368) 评论(0) 推荐(0)

摘要:Queue + hashset 阅读全文
posted @ 2016-06-17 05:44 Tonix 阅读(340) 评论(0) 推荐(0)

摘要: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 阅读全文
posted @ 2016-06-15 06:49 Tonix 阅读(218) 评论(0) 推荐(0)

摘要: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 阅读全文
posted @ 2016-06-15 05:40 Tonix 阅读(226) 评论(0) 推荐(0)

摘要:An intuitive DP - should be 'medium'. 阅读全文
posted @ 2016-06-07 06:20 Tonix 阅读(287) 评论(0) 推荐(0)

摘要:BFS solution is intuitive - here I will show a DFS based solution: 阅读全文
posted @ 2016-06-05 10:05 Tonix 阅读(123) 评论(0) 推荐(0)