Tag: depth first search algorithm
Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all …
A string S represents a list of words. Each letter in the word has 1 or more options. If there is one option, the letter is represented as is. …
You have a set of tiles, where each tile has one letter tiles printed on it. Return the number of possible non-empty sequences of letters you can make. Example …
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 / …