Wrong answer through this approch

i am getting wrong answer through this approach. Both right as well as left view are getting printed.can you tell my mistake in this code.

hello @aditikandhway
image

use this method for tree constrcution because we r given level order .