java solution of leetcode