Maximize Sum of Array Multiplication
Problem Overview
- Core task: Rearrange an array so the weighted sum 1data[1] + ... + ndata[n] is maximized.
- I/O: Input int[] data (1-indexed); output int[] permutation of indices (1-based) maximizing the sum; if ties, return the lexicographically smallest.
- Context: Weighted ranking and ordering in optimization/prioritization scenarios.
- Source: Asked in Amazon interviews; common coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
