My Solution for LeetCode Online Judge