Here is the question. I came up with the answer without looking the answer, bottom up dynamic programming (dp) is not a very easy to design at the beginning. Starting from top down + cache, I wrote it a few times, and simplified it a little bit each time, and finally passed the OJ. Python […]
Category: Leetcode
Problem Statement Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h. Example: The easiest way is to traverse […]