Correct answer not coming after submission

import java.util.*;
public class Main {
private class Node {
int data;
Node left;
Node right;
public Node(int data,Node left,Node right) {
// TODO Auto-generated constructor stub
this.data = data;
this.left = left;
this.right = right;

	}
	
}
private Node root = null;
static int maxLevel =0;

public void LeftView() {
	LeftView(this.root,1);
}
private void LeftView(Node node , int level) {
 if(node== null) {
	 return;
 }
  if(maxLevel < level) {
	  System.out.print(" " + node.data);
	  maxLevel = level;
  }
  LeftView(node.left,level+1);
  LeftView(node.right,level+1);

}
public static void main(String args[]) {
  
  Main tree = new Main();
  tree.LeftView();
}

}

where are you taking the input? Level order input for the binary tree will be given. Read that

I am not able to understand how to take level order input from the user. Please help.

Level order input is taken and tree is build by using the queue, in which firstly u will take a queue of nodes, and then it will have a data which will represent a root node, and then u will accept the left and right child of root node, -1 value means that the node does not have any child.

U can refer to this code for your help :smiley: