Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 2 3 4 5 6 7 8 9 ··· 25 下一页

2016年6月18日

摘要: 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 阅读(362) 评论(0) 推荐(0)

2016年6月17日

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

2016年6月15日

摘要: 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 阅读(216) 评论(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 阅读(225) 评论(0) 推荐(0)

2016年6月7日

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

2016年6月5日

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

2016年5月18日

摘要: Problem Reason Reference Moving ZeroesSort Colors Corner cases Shortest Word Distance Thought: 2 ptr chasing Merge 2 sorted ListsRemove Linked List El 阅读全文
posted @ 2016-05-18 09:34 Tonix 阅读(127) 评论(0) 推荐(0)

2016年5月11日

摘要: Kruskal Algorithm is based on Union-Find - quite intuitive. 阅读全文
posted @ 2016-05-11 13:52 Tonix 阅读(325) 评论(0) 推荐(0)

摘要: An intuitive Prim algorithm impl. 阅读全文
posted @ 2016-05-11 07:14 Tonix 阅读(274) 评论(0) 推荐(0)

2016年5月7日

摘要: We don't have to keep a complete chess board.. just counters! 阅读全文
posted @ 2016-05-07 14:05 Tonix 阅读(300) 评论(0) 推荐(0)

摘要: Two tricks here: 1. Counting no. of inversed pairs - using Merge Sort, nothing special 2. How to check 'chaotic'? We simply check if any number is ove 阅读全文
posted @ 2016-05-07 13:30 Tonix 阅读(601) 评论(0) 推荐(0)

2016年5月3日

摘要: A typical solution is heap based - "top K". Complexity is O(nlgk). There is a O(n) one indeed - bucketing the frequencies.https://leetcode.com/discuss 阅读全文
posted @ 2016-05-03 09:19 Tonix 阅读(185) 评论(0) 推荐(0)

2016年4月20日

摘要: A typical CS style DP based solution: But there's a Math based solution: https://leetcode.com/discuss/98249/easy-to-understand-c-with-explanationIn wh 阅读全文
posted @ 2016-04-20 07:15 Tonix 阅读(123) 评论(0) 推荐(0)

2016年4月15日

摘要: Fun one! A combination of Greedy and DP. The solution sparkled in my mind - I almost lost it.. Greedy: we sort the input numbers and always pick k con 阅读全文
posted @ 2016-04-15 13:31 Tonix 阅读(532) 评论(2) 推荐(0)

摘要: It's more of a brain-teaser than a Game Theory problem.. 阅读全文
posted @ 2016-04-15 11:53 Tonix 阅读(263) 评论(0) 推荐(0)

2016年4月14日

摘要: It is about how to choose btw. BFS and DFS. My init thought was to DFS - TLE\MLE. And its editorial gives a very neat BFS based idea which costs much 阅读全文
posted @ 2016-04-14 13:56 Tonix 阅读(394) 评论(0) 推荐(0)

2016年4月13日

摘要: I caught the sparkle in my mind and got AC1 ! It is a great great experience ! So the basic idea: permute on 3 consecutive items doesn't change the pa 阅读全文
posted @ 2016-04-13 04:40 Tonix 阅读(411) 评论(0) 推荐(0)

2016年4月12日

摘要: It is marked as a NPC problem. However from the #1 code submission (https://www.hackerrank.com/CharlesOfria), it looks pretty much like a Brutal-Force 阅读全文
posted @ 2016-04-12 05:39 Tonix 阅读(386) 评论(0) 推荐(0)

2016年4月8日

摘要: I saw the same sub-problem in LeetCode, and there exists a O(n) neat greedy solution: Please note: '[' is the first char after 'Z'. 阅读全文
posted @ 2016-04-08 03:13 Tonix 阅读(316) 评论(0) 推荐(0)

摘要: Typical topological sorting problem .. why is it 'difficult'? 阅读全文
posted @ 2016-04-08 02:26 Tonix 阅读(244) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 25 下一页