Split customers into spending quartiles
Marketing wants customers split into 4 equal-sized spending quartiles, where 1 is the lowest-spending group and 4 is the highest-spending group.
Return customer, total_spend, and quartile.
Schema
| customer | TEXT |
| total_spend | NUMERIC |
Basic
The example input, expected output, and walkthrough for this question unlock with a Basic plan.
Basic
The reference solution and walkthrough for this question unlock with a Basic plan.
Basic
This is a Basic question
Premium practice questions unlock with a Basic plan. The full solution, expected output, and grading are available to Basic members.
RM 25/mo · cancel anytime
The interviewer's next question
Marketing only wants the VIP list this time: return customer and total_spend for just the customers in quartile 4 (the highest-spending group).
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime
Marketing changes its mind: split customers into 5 equal-ish spending groups instead of 4, same low-to-high direction. Return customer, total_spend, quintile.
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime