摘要:First problem to learn Max Flow. Ford-Fulkerson is a group of algorithms - Dinic is one of it.It is an iterative process: we use BFS to check augament
阅读全文
随笔分类 - HackerRank
摘要:Intuitive one to learn about Grundy basic :) Now every pile becomes a game, so we need to use Sprague-Grundy Theory. Calculation is quite intuitive -
阅读全文
摘要:Please note: VROOK cannot go back-ward - that leads to a simple variation to Game of Nim: just XOR. t = int(input()) for _ in range(t): n = int(input(
阅读全文
摘要:A variation to 0-1 Knapsack. (No Python code got fully AC. Python is too slow for this problem) #include <cmath> #include <cstdio> #include <vector> #
阅读全文
摘要:This is 'Difficult' - I worked out it within 45mins, and unlocked HackerRank Algorithm Level 80 yeah! So the idea is straight forward: 1. sort the inp
阅读全文
摘要:Just for study from its editorial~Lesson learnt: an optimized Hungarian Algorithm: Hopcroft-Karp Algorithm (a batched version of Hungarian)A very good...
阅读全文
摘要:A sly knapsack problem in disguise! Thanks tohttps://github.com/bhajunsingh/programming-challanges/tree/master/hackerrank/algorithms/the-indian-jobLes...
阅读全文
摘要:I had the same BFS idea as one of the AC code this: because dying pattern is spead from the initial dying ones :)#include #include #include using name...
阅读全文
摘要:Learnt from here:http://www.cnblogs.com/lautsie/p/3798165.htmlIdea is: we union all pure black edges so we get 1+ pure black edge groups. Then we can ...
阅读全文
摘要:Actually I think problem statement is somewhat misleading. No need to mention range [L, R] at all.The intention is a variation to "Largest Rectangle" ...
阅读全文
摘要:The most interesting, flexible and juicy binary tree problem I have ever seen.I learnt it from here: https://codepair.hackerrank.com/paper/5fIoGg74?b=...
阅读全文
摘要:XOR -> 0 is the key (make it even pair): http://www.cnblogs.com/lautsie/p/3908006.htmlSomething to learn about basic Game Theory: http://www.cdf.toron...
阅读全文
摘要:A typical game theory problem - Recursion + Memorized Searchhttp://justprogrammng.blogspot.com/2012/06/interviewstreet-challenges-permutation.html#.Vl...
阅读全文
摘要:Same as LintCode "Sliding Window Median", but requires more care on details - no trailing zeroes.#include #include #include #include #include #include...
阅读全文
摘要:Something to learn: Rotation ops in AVL tree does not require recursion.https://github.com/andreimaximov/hacker-rank/blob/master/data-structures/tree/...
阅读全文
摘要:Something to learn:http://blog.csdn.net/yuwenshi/article/details/36666453Shortest Job First Algorithm - kinda greedy: we do shorter job first BUT we o...
阅读全文
摘要:Regular Union-Find practice one.#include #include #include #include #include #include #include #include #include using namespace std;unordered_map ps;...
阅读全文
摘要:Typical Trie usage. But please note that it could be any order of input strings.#include #include #include #include #include #include #include using n...
阅读全文
摘要:It should be categorized as 'Advanced' I think ... Anyway, Fenwick tree is the key.Editorial:https://www.hackerrank.com/challenges/candles-2/editorial...
阅读全文
摘要:A trickier Dijkstra.#include #include #include #include #include #include #include #include #include using namespace std;const int INF = std::numeric_...
阅读全文

浙公网安备 33010602011771号