Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Binary Tree but also build up problem-solving skills.
In this problem, a binary tree of size n, find its reverse level order traversal. ie- the traversal must begin from the last level.
Example :
Input :
1
/ \
3 2
Output:
3 2 1
Explanation:
Traversing level 1 : 3 2
Traversing level 0 : 1
Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/reverse-level-order-traversal/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp14-compiler/45299a50-91a2-47f3-8dad-b1f9bce298fa