Accenture Interview Question

Tree easy Problem can be solved using preorder