Right View of Binary Tree

What mistake I have done??

Check line 59 and 60. In both recursive calls, you are calling the right subtree

OK I have changed that but now also getting incorrect ans

Refer this and cross check your code. Also maxlevel must be passed by reference