Leetcode Recursion Problems Java