Leetcode Problem 239