my solution for leetcode