Category: recursive
You need to construct a binary tree from a string consisting of parenthesis and integers. The whole input represents a binary tree. It contains an integer followed by zero, …
Given an array of integers nums, sort the array in ascending order. Example 1: Input: Output: Example 2: Input: Output: Note: 1 <= A.length <= 10000 -50000 <= A …
Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer …
Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in (R >= L). You …
Given a binary tree, collect a tree’s nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty. Example: Input: 1 / …