Java Basic Questions Leetcode Contest Solution