Queue waiting cost
Your task
A dispatch queue estimates its total waiting cost. The order at the front (position 0) waits 0 slots, the next waits 1 slot, and so on. Each order's cost is its value multiplied by how many slots it waits. Given the order values in queue order, return the total cost. Example: [5, 3, 7] gives 50 + 31 + 7*2 = 17.
Examples
queue_wait_cost(values: list[int]) -> intExample 1
Input
queue_wait_cost([5, 3, 7])Output
17