java code for leetcode