Spotify
Music streaming platform using ML for personalization and recommendation.
4 Rounds
~21 Days
Hard
The Interview Loop
Recruiter Screen (30 min)
Standard fit check, behavioral questions, and resume overview.
Technical Loop (3-4 Rounds)
Deep dive into domain knowledge, coding, and system design.
Interview Question Bank
Backend Engineer
•
Coding
•
medium
Given a stream of song IDs played by users, write a function to return the top K most frequently played songs in the last 24 hours.
#Heap
#Hash Map
#Sliding Window
Backend Engineer
•
Coding
•
easy
Given an array of song durations, find two songs that add up to exactly the length of a given commute time minus 30 seconds (for a crossfade).
#Array
#Hash Map
#Two Pointers
Backend Engineer
•
Coding
•
hard
Spotify users can organize playlists into folders. Given a nested folder structure, serialize it into a string and deserialize it back into the original structure.
#Tree
#DFS
#Serialization
Backend Engineer
•
Coding
•
medium
Given a user's listening history as a string of song genres, find the length of the longest contiguous listening session that contains at most two distinct genres.
#Sliding Window
#Hash Map
#String
Backend Engineer
•
Coding
•
medium
Implement a rate limiter for the Spotify Web API. The rate limiter should allow a maximum of 100 requests per minute per user ID.
#Concurrency
#Design
#Queue
Backend Engineer
•
Coding
•
medium
Find the shortest path between two artists based on their collaborations. You are given an API that returns a list of collaborated artists for a given artist ID.
#Graph
#BFS
#API Integration
Backend Engineer
•
Coding
•
medium
Write an algorithm to simulate Spotify's 'Shuffle' feature. Given a playlist of N songs, ensure that every song has an equal probability of being chosen, and no song is played twice until all have been played.
#Array
#Math
#Randomization
Backend Engineer
•
Coding
•
hard
You are given K sorted playlists, where each playlist is a list of song objects sorted by release date. Merge all playlists into one single sorted playlist.
#Divide and Conquer
#Heap
#Linked List
Data Engineer
•
Coding
•
medium
Write a Python function to find the top K most frequently played songs for a given user from a list of stream logs.
#Python
#Hash Maps
#Heaps
Data Engineer
•
Coding
•
medium
Given a list of user listening sessions with start and end timestamps, write a function to merge all overlapping sessions to calculate the total unique listening time.
#Python
#Intervals
#Sorting
Data Engineer
•
Coding
•
hard
Design a sliding window algorithm to count the number of streams a track received in the last 5 minutes, updating in real-time.
#Data Structures
#Queues
#Real-time Processing
Data Engineer
•
Coding
•
medium
Write a function to find the longest streak of consecutive days a user listened to a specific podcast.
#Python
#Arrays
#Hash Sets
Data Engineer
•
Coding
•
medium
Implement a rate limiter for a Spotify API endpoint that allows a maximum of 100 requests per minute per user.
#Token Bucket
#System Design
#Concurrency
Data Engineer
•
Coding
•
easy
Given a playlist of track durations, find if there are two tracks that add up to exactly a target duration (Two Sum variant).
#Python
#Hash Maps
Data Scientist
•
Coding
•
medium
Given a list of user listening histories, write a function to find the longest contiguous subsegment of songs by the same artist.
#Python
#Arrays
#Two Pointers
Data Scientist
•
Coding
•
hard
Implement the K-means clustering algorithm from scratch in Python.
#Machine Learning
#Python
#Math
Data Scientist
•
Coding
•
easy
Write a Python function to calculate the cosine similarity between two user embedding vectors.
#Python
#Math
#Vectors
Data Scientist
•
Coding
•
medium
Simulate a biased coin (e.g., 70% heads) using a fair coin in Python.
#Probability
#Simulation
#Python
Frontend Engineer
•
Coding
•
medium
Implement an LRU (Least Recently Used) Cache class to store recently searched artists on the client side.
#Data Structures
#Caching
#JavaScript
#Map
Frontend Engineer
•
Coding
•
easy
Write a function to flatten a deeply nested array of playlist tracks into a single-level array.
#JavaScript
#Recursion
#Arrays
Frontend Engineer
•
Coding
•
easy
Write a utility function to parse a Spotify URI (e.g., `spotify:track:12345`) and extract the entity type and ID.
#String Manipulation
#Regex
#JavaScript
Frontend Engineer
•
Coding
•
medium
Implement a deep clone function in JavaScript without using `JSON.parse(JSON.stringify())` or `structuredClone`.
#JavaScript
#Recursion
#Objects
#Memory Management
Frontend Engineer
•
Coding
•
medium
Write a function to merge overlapping intervals representing a user's listening sessions to calculate total unique listening time.
#Arrays
#Sorting
#Time Complexity
Full Stack Engineer
•
Coding
•
easy
Given an array of integers representing daily active users over time, find the maximum profit you could make by buying and selling Spotify stock (Best Time to Buy and Sell Stock).
#Arrays
#Dynamic Programming
Full Stack Engineer
•
Coding
•
medium
Implement an LRU Cache. This is often used in our mobile and web clients to cache recently played songs or album art.
#Data Structures
#Linked List
#Hash Map
Full Stack Engineer
•
Coding
•
hard
Write a function to merge K sorted arrays. Imagine each array represents a sorted list of timestamps when a user listened to a podcast.
#Heap
#Divide and Conquer
Full Stack Engineer
•
Coding
•
easy
Given an array of song durations and a target playlist duration, find two songs whose total duration exactly matches the target.
#Hash Map
#Arrays
Full Stack Engineer
•
Coding
•
medium
Given a string representing a user's listening history (e.g., 'ABCBAC'), find the length of the longest substring without repeating characters.
#Sliding Window
#Strings
Full Stack Engineer
•
Coding
•
easy
Implement a function to flatten a deeply nested array of playlist folders into a single flat array.
#Recursion
#Arrays
#JavaScript
Full Stack Engineer
•
Coding
•
medium
Write an algorithm to find the 'k' closest songs to a given song based on a similarity score.
#Heap
#Sorting
Full Stack Engineer
•
Coding
•
medium
Given a binary tree representing a hierarchical genre classification, write a function to find the lowest common ancestor of two genres.
#Trees
#DFS
Full Stack Engineer
•
Coding
•
easy
Write a function to determine if a given string is a valid palindrome, considering only alphanumeric characters. Useful for validating certain user inputs.
#Strings
#Two Pointers
Machine Learning Engineer
•
Coding
•
hard
Given a string representing a user's listening session (where characters represent genres), find the shortest contiguous substring that contains at least one of every genre in a given target set.
#Sliding Window
#Hash Maps
#Strings
Machine Learning Engineer
•
Coding
•
medium
Given a string without spaces (e.g., a concatenated search query) and a dictionary of valid artist names, determine if the string can be segmented into a space-separated sequence of valid artists.
#Dynamic Programming
#Strings
Machine Learning Engineer
•
Coding
•
medium
Implement a rate limiter for the Spotify Web API to prevent abuse.
#System Design
#Concurrency
#Data Structures
Machine Learning Engineer
•
Coding
•
medium
Given an array of song durations and a maximum time limit, find the longest contiguous sub-array of songs that fit within the time limit.
#Sliding Window
#Arrays
Machine Learning Engineer
•
Coding
•
hard
Write an algorithm to merge K sorted lists of top tracks from different geographical regions into a single global top tracks list.
#Linked Lists
#Heaps
#Divide and Conquer
Machine Learning Engineer
•
Coding
•
medium
Given a log of user listening history, write a function to return the top K most frequently played artists.
#Heaps
#Hash Maps
#Data Structures
Machine Learning Engineer
•
Coding
•
easy
Given two strings representing song titles, write a function to determine if they are anagrams of each other (useful for fuzzy search matching).
#Strings
#Hash Maps
#Sorting
Software Engineer
•
Coding
•
medium
Find the longest consecutive listening session from a log of user play events. Each event has a start_time and end_time. A session is continuous if the gap between songs is less than 5 seconds.
#Intervals
#Sorting
#Arrays
Software Engineer
•
Coding
•
hard
Calculate the minimum number of skips required to reach a target song in a circular queue, given that the user can skip forward by 1, skip forward by 3, or go back by 1.
#Dynamic Programming
#BFS
Software Engineer
•
Coding
•
medium
Given a graph of artists where edges represent 'Fans also like' relationships, write a function to find the shortest degree of separation between two given artists.
#Graphs
#BFS
#Shortest Path
Software Engineer
•
Coding
•
medium
Design a rate limiter for the Spotify Web API to prevent third-party applications from exceeding their quota of 10,000 requests per minute.
#Sliding Window
#Concurrency
#System Design
Software Engineer
•
Coding
•
easy
Given an array of integers representing the duration of songs in a user's queue, and a target commute time, find exactly two songs that add up to the exact commute time minus 30 seconds (for a crossfade).
#Hash Maps
#Two Pointers
Software Engineer
•
Coding
•
hard
You are given K sorted playlists (arrays of song IDs sorted by release date). Merge them into a single sorted playlist.
#Divide and Conquer
#Heaps
#Linked Lists
Software Engineer
•
Coding
•
hard
Spotify users often complain that 'random shuffle' doesn't feel random if it plays the same artist back-to-back. Design an algorithm to shuffle a playlist of songs such that songs by the same artist are spaced out as evenly as possible.
#Arrays
#Greedy
#Heaps
#Fisher-Yates
Software Engineer
•
Coding
•
medium
Given a stream of song IDs listened to by users, write a function to return the top K most played songs over a given time window.
#Heaps
#Hash Maps
#Streaming Data
Difficulty Radar
Based on recent AI-sourced data.
Meet Your Interviewers
The "Standard" Interviewer
Senior EngineerFocuses on core competencies, system constraints, and clear communication.
SimulateUnwritten Rules
Think Out Loud
Always explain your thought process before writing code or drawing architecture.