Array Partition Leetcode Solution