You are given a list of purchase events. Each event contains:
customer_id
(string or int)
amount
(integer, may be 0; assume non-negative unless stated otherwise)
Define a customer's revenue as the sum of amount across all events for that customer.
Return the k customers with the smallest total revenue.
k
customers exist, return all customers.
customer_id
ascending).
events: List[(customer_id, amount)]
,
k: int
List[customer_id]
(the
k
least-revenue customers)
n = len(events)
can be large.
m
can be up to
n
.