My leetcode solution