Uber·Software Engineer·Technical Phone Screen
- Design a data structure that tracks customer revenue and referral credit. It needs to support inserting new customers (with or without a referrer), where inserting with a referrer also bumps the referrer's total revenue. There's also a query that returns up to K customer IDs whose total revenue meets a minimum threshold, ordered by smallest revenue first.
“The insert operations are straightforward enough but the getLowestK query is where things get interesting.”