Reverse Odd Levels of Binary Tree
You're given the array of level order traversal of a perfect binary tree. Your task is to reverse the node values at each odd level of the tree.
For example, if the node values at level 3 are [2,1,3,4,7,11,29,18], then they should become [18,29,11,7,4,3,1,2].
Print the level order traversal of the reversed tree.
A binary tree is perfect if all parent nodes have two children and all leaves are on the same level.
The level of a node is the number of edges along the path between it and the root node.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)