Get Final Data

Problem Overview

  • Given an integer array for n days and k updates [l, r], negate all elements in each 1-based inclusive range and return the final array.
  • Input: data (size n) and updates (k pairs). Output: array after all range negations. Constraints: 1 ≤ n, k ≤ 1e5; |data[i]| ≤ 1e9.
  • Real-world context: time-series data processing with interval-based sign flips.
  • From Ibm interviews; a common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: