Spotify Software Engineer Interview Questions
4+ questions from real Spotify Software Engineer interviews, reported by candidates.
Round Types
Top Topics
Questions
## Problem Given a string `s` and an integer `limit`, remove the minimum number of characters so that no character appears more than `limit` times consecutively. Return the resulting string. ```python def limit_consecutive_duplicates(s: str, limit: int) -> str: pass ``` ``` Input: s = "aaabbbcc", limit = 2 Output: "aabbcc" # 'a' appears 3x consecutively -> remove 1 -> 'aa' # 'b' appears 3x -> remove 1 -> 'bb' Input: s = "aaa", limit = 1 Output: "a" Input: s = "aabbcc", limit = 3 Output: "aabbcc" # already valid Input: s = "", limit = 2 Output: "" ``` ## Follow-ups 1. Is your solution a single pass? Prove it produces the minimum number of removals. 2. What is the time and space complexity? 3. Extend to limit the total (not just consecutive) occurrences of any character to `limit`. 4. If you cannot remove characters but can rearrange them, how would you solve the problem?
## Problem You have a collection of letter tiles (with repetition). Given a target word, determine the minimum number of additional letters you need to purchase (insert) so you can spell the word. Each tile can be used at most once. ```python def min_insertions_to_make_word(tiles: list[str], target: str) -> int: pass ``` ``` Input: tiles = ['a', 'a', 'b', 'c'], target = "aabbc" Output: 2 # Have: a=2, b=1, c=1. Need: a=2, b=2, c=1. # Missing: b=1. But also missing one 'b'. Wait: need b=2, have b=1 -> need 1 more b. # Answer = 1? Check: need a=2 (have 2 ok), b=2 (have 1, need 1 more), c=1 (have 1 ok) -> 1. # Let's use a cleaner example: Input: tiles = ['a', 'b'], target = "aab" Output: 1 # Have a=1,b=1. Need a=2,b=1. Missing: 1 'a'. ``` ## Follow-ups 1. What if tiles have costs and you want to minimize total cost, not count of inserted letters? 2. How do you handle case-insensitivity? 3. Extend: given multiple target words, find the minimum total insertions to spell all of them (tiles are shared). 4. What if tiles can be wildcards that match any letter?
## Problem You are given a list of song pairs `(a, b)` meaning song `a` was played immediately before song `b` in a playlist. Reconstruct the full playlist order. Assume the input forms a single valid sequence with no ambiguity. ```python def reconstruct_playlist(pairs: list[tuple[str, str]]) -> list[str]: pass ``` ``` Input: pairs = [("Shape of You", "Blinding Lights"), ("Blinding Lights", "Levitating"), ("Levitating", "Stay")] Output: ["Shape of You", "Blinding Lights", "Levitating", "Stay"] Input: pairs = [("B","C"), ("A","B"), ("C","D")] Output: ["A", "B", "C", "D"] ``` ## Follow-ups 1. How do you identify the starting song (the one that never appears as a "next" song)? 2. What if the pairs form a cycle — how would you detect and report that? 3. If some pairs are missing (gaps in the sequence), how do you handle discontinuous playlists? 4. Extend to reconstruct a sequence where each pair says song `a` played within 2 slots before `b` (not necessarily immediately before). How does the problem change?
## Problem You are given a list of play events `(user_id, song_id)`. For each user, return the top `k` most-played songs (by play count), breaking ties by `song_id` ascending. Return a dictionary mapping each user to their ranked list. ```python def top_songs( events: list[tuple[int, int]], # (user_id, song_id) k: int ) -> dict[int, list[int]]: pass ``` ``` Input: events = [(1,101),(1,102),(1,101),(2,200),(2,201),(2,200),(2,201),(2,201)] k = 2 Output: { 1: [101, 102], # 101 played 2x, 102 played 1x 2: [201, 200] # 201 played 3x, 200 played 2x } ``` ## Follow-ups 1. How would you use a heap to get top-k without fully sorting the song list per user? 2. If the event stream is very large (billions of entries), how would you compute this with a distributed map-reduce approach? 3. How would you handle a sliding window: top-k songs played in the last 7 days? 4. Extend: return songs where play count >= some threshold `t` instead of top-k.
What Spotify Looks for in Software Engineer Interviews
Spotify Software Engineer interviews are calibrated against the level and scope expected of the role. Across 4+ verified candidate reports on LeakCode, the consistent signals interviewers look for: clear problem decomposition before coding, explicit complexity reasoning, structured handling of edge cases, and the ability to articulate trade-offs between two reasonable approaches.
The discriminator between candidates who advance and candidates who do not is rarely the final correctness of the solution. It is the path to the solution: did you ask clarifying questions, did you state your approach before coding, did you handle edge cases without prompting, and did you communicate your reasoning throughout. Reports tagged "no hire" frequently cite a working solution with poor communication; reports tagged "strong hire" cite clear thinking even when the final solution was incomplete.
How To Use This Question Set
Real interview reports are a calibration tool, not a memorization target. Companies update their question pools every 2-4 months; memorizing exact problems risks misleading you when the interviewer uses a variant. The high-leverage use: identify the patterns that appear repeatedly in Spotify Software Engineer reports, practice those patterns on similar (not identical) problems, and use the reports to understand the interviewer's typical follow-up depth.
Filter the questions below by round type, difficulty, and recency. Focus first on reports from the past 6-12 months; older reports may reference questions that have since rotated out of Spotify's pool. Reports tagged with quantified difficulty (e.g., "medium-hard") are higher-signal than reports without difficulty tags.
Round-by-Round Expectations
Spotify Software Engineer loops typically span 4-6 rounds across phone screens and on-site or virtual on-site interviews. The structure varies by company: some run 1 recruiter screen + 1 technical phone + 3-4 on-site rounds; others run 1 recruiter screen + 1 OA + 4-5 on-site rounds. The recruiter screen is logistics and culture-light; the technical phone screen is medium-difficulty coding; the on-site loop covers coding, system design (at L4+ levels), and behavioral rounds.
Each round is designed to surface a specific signal. Coding rounds: correctness, code quality, complexity reasoning, communication. System design rounds: requirements clarification, design judgment, operational thinking. Behavioral rounds: ownership scope, leadership, ambiguity tolerance, conflict navigation. Strong candidates explicitly hit each signal dimension out loud during the round; weak candidates focus only on solving the prompt.
Common Interview Mistakes At This Combination
Reports tagged "no hire" at Spotify Software Engineer commonly cite: jumping into code without clarifying requirements, coding silently for 10+ minutes without verbalizing approach, missing edge cases (empty input, single element, very large input, overflow), and producing a working solution that the candidate cannot explain or refactor when probed. Strong candidates avoid these patterns by following a consistent template: clarify, verbalize approach, code with narration, test with examples.
Behavioral and design rounds have their own failure modes. Behavioral: stories that use "we" instead of "I" diluting individual signal, stories with no quantified outcome, defensiveness when probed about failure. Design: not asking clarifying questions, not stating requirements out loud, designing for a single server when the prompt clearly implies scale, ignoring operational concerns (deployment, monitoring, rollback). These show up in roughly half of Spotify Software Engineer interview retrospectives on LeakCode.
See All 4 Spotify Software Engineer Questions
Full question text, answer context, and frequency data for subscribers.
Get Access