Java Practice Coding Problems Leetcode 15012