Challenge: nth Post-order

Let’s print the value present in the nth node when traversing a tree in post-order


Given a binary tree, print the value of nodes that will be at the nthn^{th} index when the tree is traversed in post-order.


An integer index.


Display the value of the node at the given index in post-order traversal.

Sample input

index = 5

Sample output


Let’s look at the illustration to better understanding the problem.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.