摘要:Over-thinking will not get you there though : ) The trick is QUITE easy: # of unique chars.
阅读全文
随笔分类 - HackerRank
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:A bit Greedy can achieve O(m) - the mid station between 2 adjacent cities has the longest distance within that range.
阅读全文
摘要: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
阅读全文
摘要: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.
阅读全文
摘要:Greedy - though simple, but fun!
阅读全文
摘要: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
阅读全文
摘要:Kruskal Algorithm is based on Union-Find - quite intuitive.
阅读全文
摘要:An intuitive Prim algorithm impl.
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:It's more of a brain-teaser than a Game Theory problem..
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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'.
阅读全文
摘要:Typical topological sorting problem .. why is it 'difficult'?
阅读全文
摘要:Great learning for me:https://www.hackerrank.com/rest/contests/master/challenges/lucky-numbers/hackers/turuthok/download_solution Basically it is memo
阅读全文

浙公网安备 33010602011771号