Category Archives: Source Code
British royal succession order – code
British royal succession order is also known as the line of succession to the British throne. Under common law, the crown is inherited by a sovereign’s children or by a childless sovereign’s nearest collateral line. You can get the current British monarchy succession order here. When you are asked to …
Word break using memoization – Code
Word break is to divide a string into sub-strings that defined in dictionary. The problem is usually solved with recursion. The time complexity is exponential. Here we introduce word break using memoization, which helps to improve complexity. Memoization is one of Dynamic programming(DP) techniques. DP is able to solve a …
Find a random number NOT in array – code
Combinations of adding operators and parentheses
Initialize game board in matrix – Code
Find all subset of string in dictionary – code
Find all subset of string in dictionary is to find the subset of an input string that exists in dictionary. The dictionary contains one million words. For this question, the trick is to find subset, not substring. The difference between substring and subset is: The substring is contiguous sequence of …