Tony's Log

Algorithms, Distributed System, Machine Learning

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

随笔分类 -  HackerRank

上一页 1 2 3 4 5 6 7 下一页

摘要:Over-thinking will not get you there though : ) The trick is QUITE easy: # of unique chars. 阅读全文
posted @ 2017-12-22 05:30 Tonix 阅读(130) 评论(0) 推荐(0)

摘要:Nice problem that can help you understand 2 key skills below: - How to choose between Greedy and DP Is the local optimal the ONLY option? Can other ch 阅读全文
posted @ 2017-11-27 09:54 Tonix 阅读(249) 评论(0) 推荐(0)

摘要:Swapping - is actually a useless mask to the sln of this problem. The invariance of this problem is, swapping doesn't change # of balls in each contai 阅读全文
posted @ 2017-05-12 12:48 Tonix 阅读(335) 评论(0) 推荐(0)

摘要:Hey I found problems on HackerRank is more interesting than ones on LeetCode.. Strategy: observe\analyze bit by bit - DISCRETE THINKING. The idea is l 阅读全文
posted @ 2017-05-12 12:43 Tonix 阅读(164) 评论(0) 推荐(0)

摘要:A bit Greedy can achieve O(m) - the mid station between 2 adjacent cities has the longest distance within that range. 阅读全文
posted @ 2016-08-07 13:53 Tonix 阅读(273) 评论(0) 推荐(0)

摘要:DP or Greedy - they are all in O(n) In editorial, a beautiful Greedy solution is given: "To reach the last cloud in a minimum number of steps, always 阅读全文
posted @ 2016-07-21 09:31 Tonix 阅读(325) 评论(0) 推荐(0)

摘要:Another fun Greedy problem to work on: we simply go from first to second last person, as long someone is odd, we distribute bread to her and her next. 阅读全文
posted @ 2016-07-13 07:42 Tonix 阅读(332) 评论(0) 推荐(0)

摘要:Greedy - though simple, but fun! 阅读全文
posted @ 2016-07-13 07:17 Tonix 阅读(348) 评论(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 阅读(362) 评论(0) 推荐(0)

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

摘要:An intuitive Prim algorithm impl. 阅读全文
posted @ 2016-05-11 07:14 Tonix 阅读(276) 评论(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 阅读(603) 评论(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 阅读(265) 评论(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 阅读(395) 评论(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 阅读(411) 评论(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 阅读(389) 评论(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 阅读(319) 评论(0) 推荐(0)

摘要:Typical topological sorting problem .. why is it 'difficult'? 阅读全文
posted @ 2016-04-08 02:26 Tonix 阅读(245) 评论(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 阅读(314) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 下一页