Given a binary tree and a nuber k , print all nodes that are k distant from a leaf
printKDistantfromLeaf ( node , k ) { if ( node == null ) return - 1 ; var lk = this . printKDistantfromLeaf ( node . left , k ) ; var rk = this . printKDistantfromLeaf ( node . right , k ) ; var isLeaf = lk == - 1 && lk == rk ; if ( lk == 0 || rk == 0 || ( isLeaf && k == 0 ) ) document . write ( " " + node . data ) ;