My LeetCode solution