flâneur — a map of the web's best reading

Binary Tree Zigzag Level Order Traversal - LeetCode

leetcode.com · saved by 1 readers

Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level and alternate between). Example 1: Example 2: Example 3: Constraints: 1. Please don't post any solutions in this discussion. 2. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions. 3. If you'd like to share your solution for feedback and ideas, please head to the solutions tab and post it there. Started this week with :I am freaking Genius! And ending it with :back to being dumb. Leetcode be like* Enough Trees, let's give them forest now. It seems like the solution can be obtained by just manipulating the answer from the level order question. Input: {1,2,3,4,#,#,5} Output: [[1],[3,2],[5,4]] Expected: [[1],[3,2],[4,5]] Do they need to pay more ,if they provide some good examples Hint even the medium questions are suspiciously easy. [1,2,3,4,5] in this test case outp

Explore this link on the map →

saved by