InterviewDB
Experience
Paying Bonuses - Distribute Bonus Pool Based on Performance Tiers
phone
Interview Experience
Problem
You have a bonus pool of total_budget dollars to distribute among employees. Employees are ranked by performance score. The distribution rules:
- Top 10% of employees receive 3x the base share.
- Next 20% receive 2x the base share.
- Remaining 70% receive 1x the base share.
- Base share =
total_budget / weighted_employee_count.
python
def distribute_bonuses(
employees: List[dict], # [{"id": str, "score": float}]
total_budget: float
) -> List[dict]: # [{"id": str, "bonus": float}]
...
Example:
employees = [
{"id": "e1", "score": 95},
{"id": "e2", "score": 80},
{"id": "e3", "score": 60},
{"id": "e4", "score": 40}
], total_budget = 10000
# Top 10% (1 emp) -> 3x, Next 20% (1 emp) -> 2x, Rest (2 emps) -> 1x
# Weighted total = 3+2+1+1 = 7 shares
# base = 10000/7 ~ 1428.57
-> [{"id":"e1","bonus":4285.71}, {"id":"e2","bonus":2857.14},
{"id":"e3","bonus":1428.57}, {"id":"e4","bonus":1428.57}]
Follow-ups
- How do you handle ties at the tier boundaries?
- Ensure the distributed amounts sum exactly to
total_budget- how do you handle rounding errors? - How would you add a minimum bonus guarantee for all employees?
- Extend to support per-department budget caps.
Full Details
Problem
You have a bonus pool of total_budget dollars to distribute among employees. Employees are ranked by performance score. The distribution rules:
- Top 10% of employees receive 3x the base share.
- Next 20% receive 2x the base share.
- Remaining 70% receive 1x the base share.
- Base share =
total_budget / weighted_employee_count.
python
def distribute_bonuses(
employees: List[dict], # [{"id": str, "score": float}]
total_budget: float
) -> List[dict]: # [{"id": str, "bonus": float}]
...
Example:
employees = [
{"id": "e1", "score": 95},
{"id": "e2", "score": 80},
{"id": "e3", "score": 60},
{"id": "e4", "score": 40}
], total_budget = 10000
# Top 10% (1 emp) -> 3x, Next 20% (1 emp) -> 2x, Rest (2 emps) -> 1x
# Weighted total = 3+2+1+1 = 7 shares
# base = 10000/7 ~ 1428.57
-> [{"id":"e1","bonus":4285.71}, {"id":"e2","bonus":2857.14},
{"id":"e3","bonus":1428.57}, {"id":"e4","bonus":1428.57}]
Follow-ups
- How do you handle ties at the tier boundaries?
- Ensure the distributed amounts sum exactly to
total_budget- how do you handle rounding errors? - How would you add a minimum bonus guarantee for all employees?
- Extend to support per-department budget caps.
Free preview. Unlock all Gusto questions →
About This Question
This is a candidate experience report from a gusto interview during the phone round.
It covers the following topics: System Design, Coding, Phone, Onsite .