Tony's Log

Algorithms, Distributed System, Machine Learning

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

04 2016 档案

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

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

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

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

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

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

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

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

摘要:Great learning for me:https://www.hackerrank.com/rest/contests/master/challenges/lucky-numbers/hackers/turuthok/download_solution Basically it is memo 阅读全文
posted @ 2016-04-07 02:40 Tonix 阅读(316) 评论(0) 推荐(0)

摘要:Besides the common stack-based solutions, here is another recursive NestedIterator solution :) And here's my stack-based solution: 阅读全文
posted @ 2016-04-06 03:18 Tonix 阅读(274) 评论(0) 推荐(0)

摘要:A simple variation to "Longest Substring with At Most Two Distinct Characters". A typical sliding window problem. 阅读全文
posted @ 2016-04-04 02:53 Tonix 阅读(198) 评论(0) 推荐(0)

摘要:Nothing special. Just take care of corner cases. class Solution { public: /** * @param head a ListNode * @oaram v1 an integer * @param v2 an integer * 阅读全文
posted @ 2016-04-01 13:37 Tonix 阅读(180) 评论(0) 推荐(0)