Tag: binary tree algorithm
Given a binary tree root, return whether all leaves are at the same level. Constraints n ≤ 100,000 where n is the number of nodes in root Breadth First …
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, return the sum of all node values whose grandparents have an even value. Constraints 0 ≤ n ≤ 100,000 where n is the number …
Given a binary tree root, repeatedly delete all leaves that have even values. That is, if after deletions, a node becomes a leaf with an even value, it too …
Given the root of a binary tree and a node u in the tree, return the nearest node on the same level that is to the right of u, …