Algorithm · JPMorgan · Medium
Requirements You receive an integer array named arr together with a collection of intervals. For every interval, reverse the sign of each element whose index falls within that range: for instance, +1 becomes -1 and -5 becomes 5. Process the intervals sequentially and return the array after all of their effects have been applied. Before implementation, establish whether ranges include both endpoints and whether indexing starts at 0 or at 1.
Checking your access…