Spotify Coding Interview Questions
31 Spotify coding interview problems with full optimal solutions — 22 easy, 7 medium, 2 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Spotify interviewer values, and a FAQ section.
Showing 7 problems of 31
- #23mediumfoundational
23. Longest Substring Without Repeating Characters
Find the longest window of unique characters in a string — the sliding-window technique translates directly to computing rolling unique-listener counts across a time-series of Spotify stream events.
- #24mediumfoundational
24. LRU Cache
Design a cache that evicts the least-recently-used item when capacity is exceeded — exactly the structure Spotify uses to keep the most recently played tracks resident in memory without re-fetching from object storage.
- #25mediumfoundational
25. Coin Change
Find the minimum number of coins to reach a target amount — a bottom-up DP pattern Spotify applies to cost-minimization in dynamic ad-insertion and playlist-segment composition problems.
- #26mediumfoundational
26. Course Schedule
Determine whether all courses can be finished given prerequisite pairs — cycle detection in a directed graph, mirroring how Spotify validates dependency ordering in its microservice deployment pipeline.
- #27mediumfoundational
27. Find Median from Data Stream
Return the running median as numbers arrive one-by-one using two heaps — a pattern Spotify uses to compute real-time median session-length or track-duration statistics across millions of concurrent streams.
- #28mediumfoundational
28. Word Break
Determine if a string can be segmented into dictionary words using DP — a tokenisation technique Spotify applies in NLP preprocessing of lyrics and podcast transcripts before feeding text to recommendation models.
- #29mediumfoundational
29. Graph Valid Tree
Determine whether n nodes and given edges form a valid tree — union-find cycle detection that Spotify applies when validating artist-collaboration graphs to ensure no circular attribution loops exist.