Tag: dfs
Teaching Kids Programming: Videos on Data Structures and Algorithms Given two binary trees root0 and root1, return whether the sequence of leaves left-to-right in both trees are the same. …
Teaching Kids Programming: Videos on Data Structures and Algorithms Given a binary tree root, return whether all leaves are at the same level. Constraints n ≤ 100,000 where n …
Given a binary tree root, return the sum of the longest path from the root to a leaf node. If there are two equally long paths, return the larger …
Given a binary tree root, remove all nodes with only one child. Constraints n ≤ 100,000 where n is the number of nodes in root Example 1 Input root …
Given a positive integer n, return whether n can be written as the sum of distinct positive factorial numbers. Example 1 Input n = 31 Output true Explanation Since …