private int findMaxDistanceToLeaf(TreeNode node){
        if(node==null){
            return 0;
        }
        if(node.left==null && node.right==null){
            return 1;
        }
        if(node.right==null){
            return 1+findMaxDistanceToLeaf(node.left);
        }
        if(node.left==null){
            return 1+findMaxDistanceToLeaf(node.right);
        }
        return Math.max(1+findMaxDistanceToLeaf(node.left), 1+findMaxDistanceToLeaf(node.right));
    }