Let us create the tree as shown in the example
GFG tree = new GFG ( ) ; tree . root = new Node ( 12 ) ; tree . root . left = new Node ( 5 ) ; tree . root . left . left = new Node ( 3 ) ; tree . root . left . right = new Node ( 9 ) ; tree . root . left . left . left = new Node ( 1 ) ; tree . root . left . right . left = new Node ( 1 ) ; if ( tree . check ( tree . root ) ) { Console . WriteLine ( " Leaves ▁ are ▁ at ▁ same ▁ level " ) ; } else { Console . WriteLine ( " Leaves ▁ are ▁ not ▁ at ▁ same ▁ level " ) ; } } }