Search
⌘K

Leetcode 1104. Path In Zigzag Labelled Binary Tree

Given a node label in an infinite binary tree whose rows alternate left-to-right and right-to-left labeling, return the sequence of labels from the root to that node. The core challenge is to account for the per-level zigzag mirroring by mapping labels to their equivalent normal binary-tree indices (and vice versa) to trace ancestors up the tree.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.