In-Memory Revenue Tracker with Referral Attribution

Asked at Databricks · Coding Questions · Difficulty: Medium · Last asked Jun 5, 2026

Build an in-memory tracker for a business that rewards referrals. Customers spend money, and a customer may have been referred by another customer. When a referred customer spends, a fixed share of that amount is credited to whoever referred them, and optionally further up the referral chain with a shrinking share. The tracker answers how much revenue each customer generated directly, how much was credited to them, and the total.

Loading the problem…