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 (multiplied by -1). 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 have been applied. Function Complete the function getFinalData in the editor. data : the initial data array updates : updates in the form [[l, r], ...] Return the final data array after all updates. Input Format The first line contains an integer n . The second line contains n space-separated integers, the initial data. The third line contains an integer k . Each of the next k lines contains two integers l and r (1-based, inclusive). Output Format Print n space-separated integers: the final data array. Examples Example 1 Input: 4 1 -4 -5 2 2 2 4