arr [ ] : sequence of root to leaf path
arr = [ 5 , 8 , 6 , 7 ] NEW_LINE n = len ( arr ) NEW_LINE root = Node ( 5 ) NEW_LINE root . left = Node ( 3 ) NEW_LINE root . right = Node ( 8 ) NEW_LINE root . left . left = Node ( 2 ) NEW_LINE root . left . right = Node ( 4 ) NEW_LINE root . left . left . left = Node ( 1 ) NEW_LINE root . right . left = Node ( 6 ) NEW_LINE root . right . left . right = Node ( 7 ) NEW_LINE if existPath ( root , arr , n , 0 ) : NEW_LINE INDENT print ( " Path ▁ Exists " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Path ▁ does ▁ not ▁ Exist " ) NEW_LINE DEDENT