Company: Amazon_3oct
Difficulty: medium
Total 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 = [volumes[l], volumes[l+1], ..., volumes[r]] is defined by the number of indices i that satisfy these conditions: l <= i <= r (meaning i is an index within the subarray B , from its start l to its end r ) For every index j such that i < j <= r , volumes[i] > volumes[j] 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: Input: n = 6 volumes = [3, 6, 2, 9,