Patching Array Leetcode Solution 21