qqiangwuinDS Adventure572. Subtree of Another TreeEnumerate all subtrees of tree s, and check whether the subtree is equal to t.Jun 21, 2017Jun 21, 2017
qqiangwuinDS Adventure606. Construct String from Binary TreeSimple recursion problem.Jun 21, 2017Jun 21, 2017
qqiangwuinDS Adventure599. Minimum Index Sum of Two ListsWe can simply enumerate all potential pairs, which costs O(mn).Jun 21, 2017Jun 21, 2017
qqiangwuinDS Adventure623. Add One Row to TreeJust a procedural problem. Do it according to the definition.Jun 20, 2017Jun 20, 2017
qqiangwuinDS Adventure624. Maximum Distance in ArraysMake sure you understand the problem:Jun 19, 2017Jun 19, 2017
qqiangwuinDS Adventure611. Valid Triangle NumberThe obvious solution is to enumerate all possible solutions which costs O(n³). 1000³ = 10⁹ will produce a TLE. For faster lookup, we can…Jun 18, 2017Jun 18, 2017
qqiangwuinDS Adventure561. Array Partition IActually, this is a math problem.Jun 18, 2017Jun 18, 2017
qqiangwuinDS Adventure440. K-th Smallest in Lexicographical OrderThe easiest way is just to linear search the solution space which is not that obvious. Soon I find we can use DFS to generate the solution…Apr 1, 2017Apr 1, 2017