FastPrepMinimum Amount
Problems/Minimum Amount

Minimum Amount

Belvedere Trading logoBelvedere Trading● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Belvedere Trading full-time online assessment. The discounts in order, the worked examples, and the input limits are about 99% the same as the report.

You are given an integer array prices. The items must be purchased from left to right.

  • The first item is purchased at full price.
  • For every later item, the discount equals the minimum original price among all previously purchased items.
  • An item's final price cannot be negative.

Return the total amount paid for all items.

Function

minimumAmount(prices: int[]) → long

Examples

Example 1

prices = [2,5,1,4]return = 8

The four costs are 2, 5 - 2 = 3, max(1 - 2, 0) = 0, and 4 - 1 = 3. Their sum is 8.

Example 2

prices = [4,9,2,3]return = 10

The four costs are 4, 9 - 4 = 5, max(2 - 4, 0) = 0, and 3 - 2 = 1. Their sum is 10.

Example 3

prices = [7]return = 7

The only item is the first item, so it is purchased at full price.

Constraints

  • 1 <= prices.length <= 10^5.
  • 1 <= prices[i] <= 10^7.

More Belvedere Trading Online Assessment questions

  • Daily Settlement for Long and Short PositionsOA · Seen Oct 2026
  • Distances to CyclesOA · Seen Oct 2026
  • Realized PnL with Oldest Inventory FirstOA · Seen Oct 2026

Similar questions at other companies

  • Focus on Efficiency (2024 NG)Google · OA
  • Minimum Cost K-Capable ModelsMicrosoft · OA
  • Optimal TransferSnowflake · OA
  • Minimize Warehouse Transfer CostAmazon · OA
  • Gas Station Loop StartNutanix · OA
  • Running Through Walls with Limited EnergyScale AI · OA
  • Redistribute MegaseedsRubrik · OA
  • Make the Array PositiveAtlassian · OA
  • Maximum Distinct Items Within a BudgetAdobe · OA
  • Maximize Compatible Car RidersUber Freight · PHONE SCREEN · ONSITE INTERVIEW
See Belvedere Trading hiring insights
Saved
class Solution {
    public long minimumAmount(int[] prices) {
      // write your code here
    }
}
Checking account…