← 返回 amazon 的题目列表Coin Denomination Optimization and Adjustment Algorithm
类型:online_judge
amazon
In Amazon's financial optimization tool, a user manages a sequence of coins with various denominations aiming to reduce their overall value by following a set of rules.
Count the number of coins with each denomination and write it down.
Remove from the paper the denominations that have less than two coins.
If there is at least one value left, find the denomination with the smallest number on the paper and increment its count.
The initial denominations are known and your task is to compute the sum of each denomination.
Input:
denom: An array of denominations
Output:
An array of new values of denominations
Example:
denominations: [[1, 4, 2, 2, 1, 1]] picked denomination: coin[1] new values: [[2, 2, 2]]
Example
Input
[1, 4, 2, 2, 1, 1]