LeetCode Jave code