LeetCode Java Code