Array Partition Leetcode Solution 8622