I got the same question as: https://leetcode.com/discuss/interview-question/2034486/Prefix-Sum-Amazon-OA
Does anyone have a better solution to this than O(n*m) as it passed only half of the test cases.