My exercise on leetcode.com