Company: Amazon_25june
Difficulty: medium
Amazon's development team is working on a feature for a new product, a smart processor. In this smart processor, quite simply, given an array of numbers, the processor gives instructions on which parts of the array to pick and combine into a new array, for each number in the original array. If it's included in the new array, its efficiency is 0; otherwise, the efficiency is the count of smaller numbers in the new array. A user has provided an integer array called arr of size n and a 2-dimensional array called pairs of size m x 2 . Each pair in the pairs array represents the starting and ending indices of a subarray within arr . For each subarray of arr represented by the array pairs , the processor is to merge and concatenate them into a new array called efficient . The efficiency of an element at index i in arr is defined as follows: if the index i has not contributed to the formation of the array efficient , the efficiency is the count of integers in efficient that have a value stric