Suno - Software Engineer Tech Screen

suno logo
suno
Software Engineer
July 21, 202515 reads

Summary

During my Software Engineer tech screen at Suno, I was given a coding problem involving calculating user credits based on a referral system with specific rules and credit limits.

Full Experience

You need to calculate the total credits for each user who has more than 0 credits. Each referral results in 100 credits for both the referrer and the referee if the referee generates a song at the first time. The maximum number of credits a user can get by referring other users is 300 additional credits.

Input: referrals = [[1,2], [1, 3], [2, 3], [2,5], [3, 9]] Users who created songs = [2, 2, 4, 2, 3, 5, 8]

Output: {userId: credits} {1: 200, 2: 200, 3: 100, 5: 100}

Interview Questions (1)

Q1
Calculate User Credits from Referrals
Data Structures & AlgorithmsMedium

You need to calculate the total credits for each user who has more than 0 credits. Each referral results in 100 credits for both the referrer and the referee if the referee generates a song at the first time. The maximum number of credits a user can get by referring other users is 300 additional credits.

Input: referrals = [[1,2], [1, 3], [2, 3], [2,5], [3, 9]] Users who created songs = [2, 2, 4, 2, 3, 5, 8]

Output: {userId: credits} {1: 200, 2: 200, 3: 100, 5: 100}

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!