leetcode sol in java