HockeyStack interview question

Some prefix sum question from leetcode