my solution to leetcode