My own leetcode exercise