Algorithm · Expedia · Medium
You are given an integer array data that represents daily data values. The entries may be positive, negative, or zero. Next, a sequence of range-negation updates is applied in order. Each update [l, r] negates every element from 1-based index l through r, inclusive; negating an element means multiplying it by -1. Return the final array after all updates have been applied. Constraints: 1 <= data.length <= 10^5 0 <= updates.length <= 10^5 -10^9 <= data[i] <= 10^9 1 <=…
Checking your access…