How to solve "Array Manipulation" on HackerRank

T he Array Manipulation challenge , as presented, is fairly simple: for a set of ranges and values, add each value to each element of an array that falls within its given range. The difficulty comes from the scale: if there are 1 0 6 10^6 1 0 6 ranges that each span 1 0 6 10^6 1 0 6 elements, the simplest solution requires 1,000,000,000,000 (that’s one quadrillion) additions and loop iterations.…