You are given two integer arrays:
int[] multiples: the multipliers available in the shopint[] prices: the corresponding prices for each multiplier
Both arrays have the same length n, and the i-th multiplier (multiples[i]) costs prices[i] coins to purchase.
You start with:
When you purchase a multiplier, your coin gain rate is multiplied by that value. For example:
You can only make purchases when you have enough coins to afford the multiplier.
Your goal is to purchase all the multipliers, in some order, such that the total time taken to finish all purchases is minimized.
Complete the function minimizeTotalTime in the editor.
minimizeTotalTime has the following parameters:
int[] multiples: an array of multipliers available in the shopint[] prices: an array of corresponding prices for each multiplier
Returns
int[]: an array of indices representing the order in which to purchase the multipliers to minimize the total time
multiples = [3, 100, 30] prices = [5, 30, 15] return = [0, 2, 1]
:O- Consolidate On-Call RotationsOA · Seen Jun 2026
- Detonate Bombs with Chain ReactionsONSITE INTERVIEW · Seen May 2026
- Evaluate a Nested Math ExpressionONSITE INTERVIEW · Seen May 2026
- Tic-Tac-Toe Game StatusPHONE SCREEN · Seen May 2026
- Longest Dictionary TokenizationPHONE SCREEN · Seen May 2026
- Minimum Cars for Rental RequestsONSITE INTERVIEW · Seen Apr 2026
- Shortest Path with Mandatory WaypointONSITE INTERVIEW · Seen Apr 2026
- Count Divisible Coin SelectionsOA · Seen Dec 2025
public int[] minimizeTotalTime(int[] multiples, int[] prices) {
// write your code here
}