Tag: recursion
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list — …
Return the root node of a binary search tree that matches the given preorder traversal. (Recall that a binary search tree is a binary tree where for every node, …
Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left …
In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1. Two nodes of a binary tree are …
A binary tree is univalued if every node in the tree has the same value. Return true if and only if the given tree is univalued. A binary tree …