[LeetCode] A better and clearer solution.