Question
Write a function that returns post order traversal list of node values?
Login to Submit
Examples
Binary tree will be created like this:
let a = {val:1, left:null, right:null};
let b = {val:2, left:null, right:null};
let c = {val:3, left:null, right:null};
let d = {val:4, left:null, right:null};
let e = {val:5, left:null, right:null};
a.left = b;
a.right = c;
b.left = d;
b.right = e;
Since a is the head of the binary tree, the function solve() will be called like this:
solve(a)
For questions asking the modification of the given binary tree, you must return the head of the same tree after the operation asked by the question is complete.