Prefix Array Question Leetcode Problem