Reported September 2026
Sunohash table

Referral Credits After a First Song

Reported by candidates from Suno's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Suno OA. Under 2s to a working solution.
Founder's read

With up to 100000 referrals and 100000 creator events, any approach that rescans the referral list for every song is dead on arrival. This Suno OA, reported in September 2026, is a hash-map simulation dressed up as a business rule. You walk the creators once, keep a few sets and counters, and sort at the end. The wording is long, but the logic is small. If you blank on the cap rules mid-assessment, StealthCoder is the invisible safety net that reads the problem and hands you a working solution.

The problem

Each referral row [referrer, referredUser] records an invitation. If a user appears as the referred user more than once, only their earliest row is valid. Process creators in order; the first time a referred user creates a song, they receive 100 credits and their valid referrer receives 100 credits.
A referrer can receive credits for at most three referred users, while a referred user's own 100-credit award is unaffected by that cap. Later songs by the same user award nothing. Return [userId, credits] rows for users with positive credits, sorted by user ID.

Function
referralSongCredits(referrals: int[][], creators: int[]) → int[][]

Examples
Example 1
referrals = [[1,2],[1,3],[2,3],[2,5],[3,9]]
creators = [2,2,4,2,3,5,8]
return = [[1,200],[2,200],[3,100],[5,100]]
Only the first invitation for user 3 is valid; first songs by users 2, 3, and 5 produce the shown balances.
Example 2
referrals = [[10,20]]
creators = [20,20]
return = [[10,100],[20,100]]
The repeated song event does not issue a second award.

Constraints
0 <= referrals.length, creators.length <= 100000
User IDs are positive integers.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is preprocessing. First pass over referrals: store referred user to referrer, but only if that referred user isn't already in the map. That enforces the earliest-row rule. Then walk creators in order. Keep a set of users who already got their first-song award. On a first song, add 100 to that user. Then look up their referrer. If one exists and that referrer has credited fewer than three distinct referred users, add 100 and bump the count. Since each referred user only triggers once, the count is just a per-referrer integer. The pitfall is applying the cap to the referred user's own 100, which it never affects. Another pitfall is letting a repeated song pay out again. At the end, filter positive balances and sort by user ID. Total cost is O(n log n) from the sort, with O(n) everything else. If the cap logic tangles on you live, StealthCoder is your hedge.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Referral Credits After a First Song cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Suno's OA.

Suno reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Referral Credits After a First Song FAQ

What's the trick in the Suno referral credits problem?+

Build a referred-to-referrer map keeping only the first row per referred user, then process creators once with a seen set. Credits go into a hash map. The cap is a per-referrer counter that only gates the referrer's bonus, never the referred user's own 100.

How hard is this OA really?+

Easy to medium. No fancy algorithm is needed. The difficulty is reading the rules carefully: earliest-row dedupe, first-song-only awards, and the three-referral cap. Most failures come from misreading, not from coding.

Does the cap affect the referred user's credits?+

No. The statement says the referred user's own 100-credit award is unaffected. Only the referrer's bonus is limited to three referred users. Award the user first, then check the referrer's counter separately.

What complexity should I aim for?+

Linear passes with hash maps plus one final sort, so O(n log n) overall. With 100000 rows on each input, nested loops or rescanning referrals per song will time out. Lookups must be O(1) by user ID.

How do I prepare for this in 48 hours?+

Practice hash-map simulation problems with dedupe and per-key caps. Write this one from scratch twice, testing empty inputs, repeated songs, duplicate referral rows, and a referrer with four referred users. Edge cases are where the points hide.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Suno.

OA at Suno?
Invisible during screen share
Get it