Tag: depth first search
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: Input: “aab” Output: , ] …
In a binary tree, a lonely node is a node that is the only child of its parent node. The root of the tree is not lonely because it …
Given a binary tree, return the sum of values of its deepest leaves. Example 1: Input: root = Output: 15 Constraints: The number of nodes in the tree is …
Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate …
Given the root of a binary tree, find the maximum average value of any subtree of that tree. (A subtree of a tree is any node of that tree …