java.lang.Object
g1101_1200.s1104_path_in_zigzag_labelled_binary_tree.Solution

public class Solution extends Object
1104 - Path In Zigzag Labelled Binary Tree.<p>Medium</p> <p>In an infinite binary tree where every node has two children, the nodes are labelled in row order.</p> <p>In the odd numbered rows (ie., the first, third, fifth,&hellip;), the labelling is left to right, while in the even numbered rows (second, fourth, sixth,&hellip;), the labelling is right to left.</p> <p><img src="https://assets.leetcode.com/uploads/2019/06/24/tree.png" alt="" /></p> <p>Given the <code>label</code> of a node in this tree, return the labels in the path from the root of the tree to the node with that <code>label</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> label = 14</p> <p><strong>Output:</strong> [1,3,4,14]</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> label = 26</p> <p><strong>Output:</strong> [1,2,6,10,26]</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= label <= 10^6</code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • pathInZigZagTree

      public List<Integer> pathInZigZagTree(int label)