LC 681, 222
681. Next Closest Time
- Find the next greater element for each number of the time string.
- String, next element
222. Count Complete Tree Nodes
- Keep going the left and keep going the right until right is null.
- If left is also null, it is a complete tree, count is (1 << height) - 1;
- If not, recurse left subtree and right subtree, count is 1 + count(left) + count(right).
- Tree, Recursion
近期评论