Java Practice Coding Problems Leetcode Two