Solved SameTree in java