Driver Code
let root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 3 ) ; root . left . left = newNode ( 4 ) ; root . left . right = newNode ( 3 ) ; root . right . right = newNode ( 4 ) ; root . right . left = newNode ( 4 ) ; let dist = 7 ; solve ( root , dist ) ;