Compute total after discounting most expensive item
Company: Other
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Take-home Project
## Problem
You are given:
- An array `prices` of length `n`, where `prices[i]` is the price of the *i-th* item.
- An integer `discountPercent` (0 to 100).
A promotion applies **only to one item**: the **most expensive** item receives `discountPercent` percent off. If there are multiple items tied for the maximum price, discount any one of them (the result is the same).
The discounted amount may be fractional. The final amount to pay is:
\[
\left\lfloor \sum prices - (\max(prices) \cdot discountPercent/100) \right\rfloor
\]
Return the final amount to pay as an integer.
### Input
- `prices`: array of non-negative numbers (integers or decimals)
- `discountPercent`: integer in `[0, 100]`
### Output
- Integer: the floored total amount to pay.
### Constraints (typical)
- `1 <= n <= 2 * 10^5`
- `0 <= prices[i] <= 10^9`
### Example
- `prices = [100, 50, 25]`, `discountPercent = 20`
- max price = 100, discount = 20
- total = floor(175 - 20) = `155`
Quick Answer: This question evaluates array manipulation and numeric computation skills—specifically identifying the maximum element, applying a percentage discount, and correctly handling fractional results and flooring—within the Coding & Algorithms domain.
Return floor(total prices minus discountPercent percent of the maximum-priced item).
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([100,50,25], 20)
Expected Output: 155
Explanation: Discount 20 percent from 100.
Input: ([10,10], 50)
Expected Output: 15
Explanation: Ties for most expensive produce the same total.
Input: ([19.99,5], 10)
Expected Output: 22
Explanation: Fractional discounted totals are floored.
Hints
- Clarify edge cases before coding.
- Keep outputs deterministic when several valid answers exist.