Sum Of All Subarrays Leetcode Javascript Interview