Densest Tree Level
Bloomberg interview questions · Medium · Coding round · 6 tests
Starting from the root of an N-ary tree, find which depth holds the greatest number of nodes and report that depth as a 1-indexed level.
Function signature
interface TreeNode {
value: number;
children: TreeNode[];
}
densestTreeLevel(root: TreeNode | null): numberRun your code with Ctrl+Enter to see results.