my own leetcode exercise