Contiguous Array Leetcode Solution 9