FastPrepRange Negation Updates
Problems/Range Negation Updates

Range Negation Updates

JP Morgan Chase logoJP Morgan Chase● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a JP Morgan Chase intern online assessment. Our version is about 99% the same as the reported question.

A data analyst has an integer array data representing values for n days. The analyst performs a sequence of updates. Each update is a pair [l, r] that negates every value from index l through index r, inclusive.

Apply all updates in order and return the final array. Indices in every update are 1-based.

Function

getFinalData(data: int[], updates: int[][]) → int[]

Examples

Example 1

data = [1,-4,6,2]updates = [[2,4],[1,2]]return = [-1,-4,-6,-2]

After update [2, 4], the array is [1, 4, -6, -2]. Applying [1, 2] then produces [-1, -4, -6, -2].

Example 2

data = [3,-2,5]updates = [[1,1],[1,3]]return = [3,2,-5]

The first update negates only the first value. The second update negates all three values, so the first value is negated twice overall while the others are negated once.

Constraints

  • Each update contains two valid 1-based indices l and r.
  • For every update, l ≤ r, and both endpoints are inclusive.

More JP Morgan Chase Online Assessment questions

  • Find Total CostOA · Seen Oct 2026
  • Minimum Meeting RoomsOA · Seen Oct 2026
  • Count Dropped RequestsOA · Seen Oct 2026
  • Maximize Minimum Deployment DifficultyOA · Seen Oct 2026
  • Task SchedulingOA · Seen Oct 2026
  • Substring RemovalOA · Seen Oct 2026
  • Maximum Game Board ScoreOA · Seen Sep 2026
  • Minimum Digit Changes Between String HalvesOA · Seen Sep 2026
  • Same Substring Within BudgetOA · Seen Sep 2026
  • Invert Ad Visibility BitsOA · Seen Aug 2026

Similar questions at other companies

  • Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
  • Array Challenge (QR Intern)Akuna Capital · OAAkuna Capital interview questions
  • Data UpdatesExpedia · OAExpedia interview questions
  • Hall of Shifting TilesAdobe · OAAdobe interview questions
  • Prefix Scores With the Running MaximumC3.ai · OAC3.ai interview questions
  • Wallet Balance on a Selected DayBharatPe · PHONE SCREEN
  • Calculate Server Shutdown PenaltyStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • Instrument Stack Language JumpsJane Street · PHONE SCREENJane Street interview questions
  • Schedule Buffered Video PlaybackNuro · PHONE SCREENNuro interview questions
  • Weighted Lottery WinnersAmazon · ONSITE INTERVIEW

JP Morgan Chase interview experiences

  • JPMorgan Chase Experienced SWE Java Interview: 1 Experience
  • JPMorgan Quant Stats Superdays: 3 Experiences (Part 3 of 3)
  • JPMorgan Quant Modeling Superdays: 7 Experiences (Part 2 of 3)
  • JPMorgan Quant Intern Superday: 19 Experiences (Part 1 of 3)
  • JP Morgan Chase Data and AI Intern Superday: 11 Experiences
  • JPMorgan Code for Good India 2024: 6 Experiences (Part 5 of 5)
All JP Morgan Chase interview questionsSee JP Morgan Chase hiring insights
Saved
class Solution {
    public int[] getFinalData(int[] data, int[][] updates) {
      // Write your code here.
    }
}
Checking account…