Company: Amazon_24oct
Difficulty: medium
Packing Efficiency Problem Description In the Amazon distribution center, there is a collection of n products, each with a distinct volume. The challenge is to evaluate the "packing efficiency" of the collection, aiming for proper utilization of space. More specifically, there is an array volumes , where volumes[i] represents the volume of the i -th product. The "packing efficiency" of a subarray B = [product[i], product[i+1], ..., product[r]] is defined by the number of indices j such that i and volume[j] > volume[i] . The total packing efficiency of the entire collection is calculated by summing the packing efficiency across all subarrays of a given size k . Given an array 'volumes' of size 'n' and an integer 'k' , compute the total packing efficiency of the collection. Examples Example 1: n = 6 volumes = [3, 6, 2, 9, 4, 1] k = 3 B = [3, 6, 2] . Elements 6 and 2, satisfies the conditions. So, the efficiency of the subarray is 2. B = [6, 2, 9] . Element 9, satisfies the conditions. So