Easiest JAVA Solutions


#1
public class Solution {
public TreeNode solve(TreeNode A) {
    if(A==null){
        return A;
    }
    A.left=  solve(A.left);
    A.right=  solve(A.right);
    if(A.left==null && A.right!=null){
        A=A.right;
    }
    if(A.right==null && A.left!=null){
        A=A.left;
    }
    return A;
}
}