Robinhood software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.
n nodes labeled 0 through n - 1. Each directed edge connects node u to node v and carries an integer...Input: Graph (nodes and edges)house) and one from the street-side...Input: Graph (nodes and edges)[prereq, course] means prereq must be taken before course.Input: Integer(s)m dollars to invest in securities. Each security is described by [symbol, currentPrice, futurePrice, maxShares]. Fractional...Input: Integer(s)id, type, referrer, and referee; type is referral.referrer != referee and the referee is not already on the platform. A rejected record has no effects, including not registering its referrer.referral_leaderboard(records: list[dict[str, str]]) -> candidate_definedThe return type is up to you; the examples use a leaderboard object containing {user, score} entries.Example 1:[
{"id":"r1","type":"referral","referrer":"Ava","referee":"Ben"},
{"id":"r2","type":"referral","referrer":"Ben","referee":"Cara"},
{"id":"r3","type":"referral","referrer":"Ava","referee":"Drew"},
{"id":"r4","type":"referral","referrer":"Cara","referee":"Ava"},
{"id":"r5","type":"referral","referrer":"Drew","referee":"Eli"}
]{"leaderboard":[{"user":"Ava","score":4},{"user":"Ben","score":1},{"user":"Drew","score":1}]}r4 is rejected because Ava already exists; Ben wins the score-1 tie over Drew.Part 2 — Qualification corrections and an auditable timelinequalification records with string fields id, type, user, and state, where state is exactly included or excluded.excluded user contributes zero credit to every ancestor; an included user contributes one. This changes only that user's contribution: descendants remain attached and contribute according to their own states.included, and qualification changes never allow a user to be referred again.id, a status of applied or ignored, and the leaderboard immediately after that record. Accepted referrals and genuine qualification changes are applied; all other records are ignored.referral_timeline(records: list[dict[str, str]]) -> candidate_definedExample 2:[
{"id":"a","type":"referral","referrer":"Ava","referee":"Ben"},
{"id":"b","type":"referral","referrer":"Ben","referee":"Cara"},
{"id":"c","type":"referral","referrer":"Cara","referee":"Dana"},
{"id":"d","type":"qualification","user":"Ben","state":"excluded"},
{"id":"e","type":"qualification","user":"Cara","state":"excluded"}
]{
"leaderboard":[{"user":"Ava","score":1},{"user":"Ben","score":1},{"user":"Cara","score":1}],
"timeline":[
{"id":"a","status":"applied","leaderboard":[{"user":"Ava","score":1}]},
{"id":"b","status":"applied","leaderboard":[{"user":"Ava","score":2},{"user":"Ben","score":1}]},
{"id":"c","status":"applied","leaderboard":[{"user":"Ava","score":3},{"user":"Ben","score":2},{"user":"Cara","score":1}]},
{"id":"d","status":"applied","leaderboard":[{"user":"Ava","score":2},{"user":"Ben","score":2},{"user":"Cara","score":1}]},
{"id":"e","status":"applied","leaderboard":[{"user":"Ava","score":1},{"user":"Ben","score":1},{"user":"Cara","score":1}]}
]
}c, the chain has scores 3, 2, and 1. Excluding Ben subtracts 1 only from Ava: her score becomes 0 + 1 + 1 = 2, while Ben still counts Cara and Dana. Excluding Cara subtracts 1 from Ava and Ben; Dana is then the sole qualifying descendant credited to each of Ava, Ben, and Cara. The final three-way tie is resolved alphabetically.Example 3:[
{"id":"p","type":"referral","referrer":"Mia","referee":"Noah"},
{"id":"q","type":"referral","referrer":"Noah","referee":"Owen"},
{"id":"r","type":"qualification","user":"Noah","state":"excluded"},
{"id":"s","type":"qualification","user":"Noah","state":"excluded"},
{"id":"t","type":"referral","referrer":"Owen","referee":"Mia"}
]{
"leaderboard":[{"user":"Mia","score":1},{"user":"Noah","score":1}],
"timeline":[
{"id":"p","status":"applied","leaderboard":[{"user":"Mia","score":1}]},
{"id":"q","status":"applied","leaderboard":[{"user":"Mia","score":2},{"user":"Noah","score":1}]},
{"id":"r","status":"applied","leaderboard":[{"user":"Mia","score":1},{"user":"Noah","score":1}]},
{"id":"s","status":"ignored","leaderboard":[{"user":"Mia","score":1},{"user":"Noah","score":1}]},
{"id":"t","status":"ignored","leaderboard":[{"user":"Mia","score":1},{"user":"Noah","score":1}]}
]
}r, Mia's score is 0 for Noah + 1 for Owen = 1; Noah still has score 1 for Owen. The repeated exclusion changes nothing. The last referral would close a cycle, but is already rejected by the existing-user rule because Mia registered at p; neither score changes.Notes:O(m log²(m + 2)) total time or better and O(m) space, including the timeline.amount representing the total amount of money and an integer array coins representing the denominations of coins, write a function to determine the minimum number of coins that you need to make up that amount. If that amount cannot be made up by any combination of the coins, return -1.Function/class signature:def min_coins(coins: List[int], amount: int) -> int:coins = [1, 2, 5], amount = 11 3 5 + 5 + 1.coins = [2], amount = 3 -1 3 with denomination 2.1 <= coins.length <= 12 1 <= coins[i] <= 2^31 - 1 0 <= amount <= 10^4 coins representing different denominations of coins and an integer amount representing a total amount of money, calculate the minimum number of coins that you need to make up that amount. If that amount cannot be made up by any combination of the coins, return -1.Function/class signature: def min_coins(coins: List[int], amount: int) -> int:coins = [1, 2, 5], amount = 11 3 coins = [2], amount = 3 -1 1 <= coins.length <= 12 1 <= coins[i] <= 2^31 - 1 0 <= amount <= 10^4 -1. The function should optimize for the number of coins used.def min_coins(coins: List[int], amount: int) -> int:coins = [1, 2, 5], amount = 113coins = [2], amount = 3 -1 1 <= len(coins) <= 100 1 <= coins[i] <= 1000 0 <= amount <= 10^4 amount and an array of integers coins, each representing the value of coins available, write a function to determine the minimum number of coins that make up the given amount. If it is not possible to make up the amount using the given coins, return -1.def min_coins(coins: List[int], amount: int) -> int:coins = [1, 2, 5], amount = 11 3 11 = 5 + 5 + 1, minimum coins needed are 3.coins = [2], amount = 3 -1 coins.length <= 12 coins[i] <= 2 * 10^4 amount <= 10^7-1.Function/class signature: def min_coins(coins: List[int], amount: int) -> int:coins = [1, 2, 5], amount = 11 3 5 and one coin of 1 to make 11. coins = [2], amount = 3 -1 3 with coin of 2 only. 1 <= len(coins) <= 100 1 <= coins[i] <= 1000 0 <= amount <= 10000 JobScheduler that can schedule tasks for execution at specific times. The class should support adding jobs and retrieving the next job to execute based on scheduled times. The class should also allow for cancellation of scheduled jobs.def add_job(job_id: int, run_time: int) -> None: # Add a job with a specified run timedef get_next_job() -> Union[int, None]: # Get the next job to executedef cancel_job(job_id: int) -> None: # Cancel a job by its IDadd_job(1, 5) then get_next_job() → Output: 1, Explanation: Job 1 is scheduled to run at time 5.add_job(2, 3), add_job(3, 4), then get_next_job() → Output: 2, Explanation: Job 2 is scheduled to run at time 3 and is the next to execute.Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free