my exercise code of leetcode online question