Twitter / X

Twitter / X

Real-time social platform with petabyte-scale data and ML ranking systems.

4 Rounds ~14 Days Hard
Start Mock Interview

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 easy

Implement a function to parse a tweet string and extract all unique hashtags and user mentions, returning them in the order they appeared.

#String Manipulation #Regex #Hash Set
Backend Engineer Coding easy

Given a string containing a tweet, check if it is a palindrome, ignoring spaces, punctuation, and casing.

#String #Two Pointers
Backend Engineer Coding easy

Given two arrays representing the followers of User A and User B, write a function to return their mutual followers. Optimize for large arrays.

#Array #Hash Set #Two Pointers
Backend Engineer Coding medium

Write a function to detect if there is a cycle in a retweet chain (represented as a directed graph).

#Graph #DFS #Cycle Detection
Backend Engineer Coding medium

Given a list of tweets with timestamps, find the maximum number of tweets published within any 5-minute sliding window.

#Sliding Window #Two Pointers #Array
Backend Engineer Coding hard

Write an algorithm to serialize and deserialize a tree of threaded replies (N-ary tree) to a string and back.

#Tree #DFS #Serialization
Backend Engineer Coding medium

Given an array of intervals representing active ad campaigns, merge all overlapping intervals to find the total continuous time ads are running.

#Array #Sorting #Intervals
Backend Engineer Coding medium

Given a list of user connections (follower/following), write a function to find the shortest connection path between two users (Degrees of Separation).

#Graph #BFS #Bidirectional BFS
Backend Engineer Coding medium

Given a stream of tweets, write an algorithm to find the top K trending hashtags over the last 1 hour.

#Heap #Hash Map #Sliding Window
Cloud Engineer Coding medium

Given a list of server connection logs represented as [start_time, end_time], write a function to find the maximum number of concurrent connections and the time it occurred.

#Algorithms #Sweep Line #Sorting
Cloud Engineer Coding medium

Given a list of microservices and their dependencies (e.g., Service A depends on Service B), write an algorithm to determine a valid deployment order.

#Graphs #Topological Sort #Algorithms
Cloud Engineer Coding medium

Implement a rate limiter class in Python or Go using the Token Bucket algorithm. It should support multiple users identified by user_id.

#Python #Go #Rate Limiting #Concurrency
Data Engineer Coding easy

Given a list of trending search terms, group the anagrams together.

#Strings #Hash Maps
Data Engineer Coding medium

Implement an LRU Cache to store recently accessed user profiles.

#Linked Lists #Hash Maps #Caching
Data Engineer Coding medium

Implement a Trie data structure to support Twitter search autocomplete.

#Trees #Trie #String Manipulation
Data Engineer Coding medium

Parse a log file of Twitter events to find the top 10 most active users in a given 1-hour window.

#Log Parsing #Hash Maps #Sorting #Priority Queue
Data Engineer Coding medium

Implement a sliding window algorithm to count the number of tweets containing a specific hashtag in the last 5 minutes.

#Sliding Window #Queues #Real-time Processing
Data Engineer Coding hard

Given K sorted streams of tweet IDs (in chronological order), merge them into a single sorted stream.

#Heaps #Pointers #Stream Processing
Data Engineer Coding hard

Find the shortest path between two users in the Twitter follower graph.

#Graphs #BFS #Bidirectional Search
Data Engineer Coding medium

Implement a rate limiter for the Twitter API using a token bucket algorithm.

#Concurrency #System Design #Object-Oriented Design
Data Engineer Coding medium

Design an algorithm to find the Top K frequent words in a continuous stream of tweets (Heavy Hitters problem).

#Count-Min Sketch #Heaps #Streaming Algorithms
Data Scientist Coding medium

Given a dataset of user sessions, write a Python script to merge overlapping session time intervals.

#Sorting #Intervals #Arrays
Data Scientist Coding medium

Implement a basic TF-IDF algorithm from scratch in Python for a small corpus of tweets.

#NLP #Hash Maps #Math
Data Scientist Coding medium

Given an array of daily tweet counts for a specific hashtag, write a Python function to find the longest contiguous streak of days where the count strictly increased.

#Arrays #Dynamic Programming
Data Scientist Coding easy

Write a Python function to calculate the cosine similarity between two sparse user-feature vectors.

#Math #Arrays #Linear Algebra
Data Scientist Coding easy

Write a Python function to parse and extract all unique trending hashtags from a massive stream of tweet texts efficiently.

#Regex #Strings #Data Structures
DevOps Engineer Coding medium

Given a list of server logs with timestamps, write a program to find the peak traffic window of exactly 5 minutes.

#Sliding Window #Data Processing #Time Series
DevOps Engineer Coding hard

Implement a basic rate limiter in Python using a token bucket algorithm to protect our Tweet posting API from abuse.

#Python #Rate Limiting #Concurrency #Algorithms
DevOps Engineer Coding easy

Write a function to validate if a given string is a valid IPv4 or IPv6 address without using built-in IP validation libraries.

#String Manipulation #Networking #Validation
Full Stack Engineer Coding hard

Find the shortest path between two users on X (Degrees of Separation). You are given an API call `getFollowers(userId)`.

#Graph Traversal #BFS #Bidirectional BFS
Full Stack Engineer Coding hard

Given K sorted arrays representing timelines of users you follow, merge them into a single sorted timeline of the most recent tweets.

#Heaps #Merge Sort #Arrays
Full Stack Engineer Coding medium

Implement a rate limiter for the X API that allows a user to make N requests per time window T. How would you handle this in a distributed environment?

#Sliding Window #Concurrency #Distributed Systems
Full Stack Engineer Coding medium

Write a function to calculate the length of a Tweet. Note that URLs always count as 23 characters, and emojis/special Unicode characters should be counted correctly as single characters despite surrogate pairs.

#String Manipulation #Regex #Unicode
Full Stack Engineer Coding medium

Given a stream of tweets, write an algorithm to find the Top K frequent words (Trending Topics) in the last hour.

#Heaps #Hash Maps #Stream Processing
Full Stack Engineer Coding easy

Write a function to parse a raw tweet string and extract all valid hashtags, ignoring punctuation immediately following the tag.

#String Parsing #Regex
Machine Learning Engineer Coding easy

Design an algorithm to detect cycles in a directed graph (e.g., detecting retweet loops or bot rings).

#Graph Theory #DFS
Machine Learning Engineer Coding medium

Implement a Trie (Prefix Tree) to support insertion, search, and prefix search. This is used for hashtag autocomplete.

#Tries #Strings #Data Structures
Machine Learning Engineer Coding hard

Given a stream of tweets, write a function to keep track of the median engagement score in a sliding window.

#Heaps #Sliding Window #Stream Processing
Machine Learning Engineer Coding medium

Design a data structure that supports insert, delete, and getRandom in O(1) time.

#Hash Tables #Arrays #Design
Machine Learning Engineer Coding medium

Given a stream of tweets, write an algorithm to find the Top K trending hashtags in the last 1 hour.

#Heaps #Sliding Window #Stream Processing
Machine Learning Engineer Coding medium

Implement a rate limiter for the Twitter API.

#System Design #Concurrency #Data Structures
Machine Learning Engineer Coding medium

Given k sorted arrays of tweet timestamps, merge them into a single sorted array.

#Heaps #Divide and Conquer #Sorting
Machine Learning Engineer Coding medium

Find the shortest path between two users in a massive social graph (degrees of separation).

#Graph Theory #BFS #Bidirectional Search
Software Engineer Coding medium

Find the shortest path (degrees of separation) between two users in a massive directed graph of followers.

#Graph #BFS #Bidirectional Search
Software Engineer Coding hard

Given a stream of tweets, find the top K most frequent hashtags in the last 5 minutes.

#Sliding Window #Heap #Queue
Software Engineer Coding medium

Implement a Token Bucket rate limiter class with an `allow_request(user_id)` method.

#Concurrency #Math #Design
Software Engineer Coding hard

Given an array of k sorted arrays representing timelines from different users, merge them into a single sorted timeline.

#Heap #Divide and Conquer #Linked List
Software Engineer Coding medium

Design a simplified version of Twitter. Implement functions to post a tweet, get the 10 most recent tweets in a news feed, follow a user, and unfollow a user.

#Hash Table #Heap #Object-Oriented Design
Software Engineer Coding medium

Implement a thread-safe counter class for tracking tweet likes in a highly concurrent environment.

#Concurrency #Multithreading
Software Engineer Coding medium

Design an Autocomplete system for X handles. Implement `insert(handle)` and `search(prefix)`.

#Trie #String #Design
Software Engineer Coding hard

Write a function to parse a massive log file of API requests and return the 99th percentile latency.

#Math #Sorting #Bucket Sort
Software Engineer Coding easy

Given an array of tweet engagement scores (positive and negative integers), find the contiguous subarray with the maximum sum.

#Array #Dynamic Programming
Software Engineer Coding medium

Implement a sliding window algorithm to detect if a user has posted more than N tweets in the last M seconds.

#Queue #Sliding Window
Software Engineer Coding easy

Given a tree representing a tweet thread (replies to replies), write a function to find the maximum depth of the thread.

#Tree #DFS #BFS
Software Engineer Coding easy

You are given a list of user connections. Find the most influential user, defined as the user with the highest in-degree in the graph.

#Graph #Hash Table
Software Engineer Coding medium

Given a string, write a parser or state machine to extract all valid @mentions and #hashtags without using built-in regex libraries.

#String #State Machine
Software Engineer Coding easy

Given a string representing a tweet, calculate its length where URLs count as exactly 23 characters, regardless of their actual length.

#String #Parsing #Regex
Software Engineer Coding medium

Implement an LRU Cache to store the most recently accessed tweets.

#Hash Table #Doubly Linked List #Design

Difficulty Radar

Based on recent AI-sourced data.

Meet Your Interviewers

The "Standard" Interviewer

Senior Engineer

Focuses on core competencies, system constraints, and clear communication.

Simulate

Unwritten Rules

Think Out Loud

Always explain your thought process before writing code or drawing architecture.

Practice Now