solution of LeetCode