Company: Microsoft_14Aug
Difficulty: medium
Array Range Negation Problem Description A data analyst is given an array representing data for n days. The analyst performs k updates on the data, where each update is of the form [l, r] . This indicates that the elements of the array from index l to index r (inclusive) are negated. Note: 1-based indexing is used for the update ranges. Given the initial data array and k updates, return the final data array after all updates. Function Description Complete the function getFinalData in the editor with the following parameters: int data[n] : the initial data array. int updates[k][2] : updates in the form of [[l, r]] . Returns int[n] : the final data array after all updates. Examples Example 1: Input: data = [1, -4, -5, 2] k = 2 updates = [[2, 4], [1, 2]] Output: [-1, -4, 5, -2] Explanation: Initial data: [1, -4, -5, 2] (Here, n is implicitly 4) After the first update [2, 4] (negate elements at 1-based indices 2, 3, 4): data becomes [1, 4, 5, -2] After the second update [1, 2] (negate elem