Problem database last updated: June 20, 2025

XX logo

X Coding Interview Questions

45 problems · 8 Easy, 27 Medium, 10 Hard · Ranked #47 of 458

Difficulty breakdown

8 Easy

18% · avg 23%

27 Medium

60% · avg 59%

10 Hard

22% · avg 18%

Top topics

array
40%
hash-table
31.1%
string
28.9%
design
17.8%3.1x
math
15.6%
linked-list
13.3%1.8x

Interview profile

Based on 45 reported problems, X interviews are slightly harder than average - 22% Hard vs 18% across all companies. The majority (60%) of questions are Medium difficulty, which is typical for companies that want to see solid fundamentals without excessive trick questions.

Compared to the industry average, X puts unusual emphasis on database (8.9% of problems, 7.9x the industry average), randomized (4.4% of problems, 4.8x the industry average), ordered-set (4.4% of problems, 4.4x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (40%), hash-table (31.1%), string (28.9%), design (17.8%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 45 problems

Insert Delete GetRandom O(1)

Solve

Implement the RandomizedSet class:

MediumVery Likely
arrayhash-tablemath

Trapping Rain Water

Solve

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

HardVery Likely
arraytwo-pointersdynamic-programming

Flatten Nested List Iterator

Solve

You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an...

MediumVery Likely
stacktreedepth-first-search

Design Twitter

Solve

Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the 10 most recent tweets in the user's new...

MediumVery Likely
hash-tablelinked-listdesign

Implement Trie (Prefix Tree)

Solve

A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various appl...

MediumVery Likely
hash-tablestringdesign

Merge Intervals

Solve

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cove...

MediumVery Likely
arraysorting

Tweet Counts Per Frequency

Solve

A social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These periods can be...

MediumVery Likely
hash-tablestringbinary-search

Investments in 2016

Solve

Table: Insurance

MediumVery Likely
database

LRU Cache

Solve

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.

MediumVery Likely
hash-tablelinked-listdesign

Permutation Sequence

Solve

The set [1, 2, 3, ..., n] contains a total of n! unique permutations.

HardVery Likely
mathrecursion

Multiply Strings

Solve

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

MediumVery Likely
mathstringsimulation

Regular Expression Matching

Solve

Given an input string s and a pattern p, implement regular expression matching with support for '.' and '' where:

HardVery Likely
stringdynamic-programmingrecursion

Remove All Occurrences of a Substring

Solve

Given two strings s and part, perform the following operation on s until all occurrences of the substring part are removed:

MediumVery Likely
stringstacksimulation

Trapping Rain Water II

Solve

Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining.

HardVery Likely
arraybreadth-first-searchheap-priority-queue

Number of Black Blocks

Solve

You are given two integers m and n representing the dimensions of a 0-indexed m x n grid.

MediumVery Likely
arrayhash-tableenumeration

Max Points on a Line

Solve

Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line.

HardVery Likely
arrayhash-tablemath

Validate IP Address

Solve

Given a string queryIP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of any type.

MediumVery Likely
string

The Skyline Problem

Solve

A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of...

HardVery Likely
arraydivide-and-conquerbinary-indexed-tree

Design Authentication Manager

Solve

There is an authentication system that works with authentication tokens. For each session, the user will receive a new authentication token that will expire tim...

MediumVery Likely
hash-tablelinked-listdesign

Word Break II

Solve

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possi...

HardVery Likely
arrayhash-tablestring

Minimum Number of Steps to Make Two Strings Anagram

Solve

You are given two strings of the same length s and t. In one step you can choose any character of t and replace it with another character.

MediumVery Likely
hash-tablestringcounting

Count Sub Islands

Solve

You are given two m x n binary matrices grid1 and grid2 containing only 0's (representing water) and 1's (representing land). An island is a group of 1's connec...

MediumVery Likely
arraydepth-first-searchbreadth-first-search

Lowest Common Ancestor of a Binary Search Tree

Solve

Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.

MediumVery Likely
treedepth-first-searchbinary-search-tree

Time Needed to Buy Tickets

Solve

There are n people in a line queuing to buy tickets, where the 0th person is at the front of the line and the (n - 1)th person is at the back of the line.

EasyVery Likely
arrayqueuesimulation

Process Tasks Using Servers

Solve

You are given two 0-indexed integer arrays servers and tasks of lengths n​​​​​​ and m​​​​​​ respectively. servers[i] is the weight of the i​​​​​​th​​​​ server,...

MediumVery Likely
arrayheap-priority-queue

Kth Smallest Element in a Sorted Matrix

Solve

Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element in the matrix.

MediumVery Likely
arraybinary-searchsorting

Design Skiplist

Solve

Design a Skiplist without using any built-in libraries.

HardVery Likely
linked-listdesign

Finding the Users Active Minutes

Solve

You are given the logs for users' actions on LeetCode, and an integer k. The logs are represented by a 2D integer array logs where each logs[i] = [IDi, timei] i...

MediumVery Likely
arrayhash-table

Happy Number

Solve

Write an algorithm to determine if a number n is happy.

EasyVery Likely
hash-tablemathtwo-pointers

Valid Parentheses

Solve

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

EasyVery Likely
stringstack

Pascal's Triangle

Solve

Given an integer numRows, return the first numRows of Pascal's triangle.

EasyVery Likely
arraydynamic-programming

Reverse Linked List

Solve

Given the head of a singly linked list, reverse the list, and return the reversed list.

EasyVery Likely
linked-listrecursion

Integer to Roman

Solve

Seven different symbols represent Roman numerals with the following values:

MediumVery Likely
hash-tablemathstring

Invalid Tweets

Solve

Table: Tweets

EasyVery Likely
database

Merge k Sorted Lists

Solve

You are given an array of k linked-lists lists, each linked-list is sorted in ascending order.

HardVery Likely
linked-listdivide-and-conquerheap-priority-queue

Wildcard Matching

Solve

Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '' where:

HardVery Likely
stringdynamic-programminggreedy

Masking Personal Information

Solve

You are given a personal information string s, representing either an email address or a phone number. Return the masked personal information using the below ru...

MediumVery Likely
string

Minimum Elements to Add to Form a Given Sum

Solve

You are given an integer array nums and two integers limit and goal. The array nums has an interesting property that abs(nums[i]) <= limit.

MediumVery Likely
arraygreedy

Binary Gap

Solve

Given a positive integer n, find and return the longest distance between any two adjacent 1's in the binary representation of n. If there are no two adjacent 1'...

EasyVery Likely
bit-manipulation

Customer Placing the Largest Number of Orders

Solve

Table: Orders

EasyVery Likely
database

Minimum Genetic Mutation

Solve

A gene string can be represented by an 8-character long string, with choices from 'A', 'C', 'G', and 'T'.

MediumVery Likely
hash-tablestringbreadth-first-search

Tree Node

Solve

Table: Tree

MediumVery Likely
database

Random Pick with Weight

Solve

You are given a 0-indexed array of positive integers w where w[i] describes the weight of the ith index.

MediumSometimes
arraymathbinary-search

Rotting Oranges

Solve

You are given an m x n grid where each cell can have one of three values:

MediumSometimes
arraybreadth-first-searchmatrix

Number of Islands

Solve

Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.

MediumSometimes
arraydepth-first-searchbreadth-first-search

How often are these problems asked?

Frequency scores are based on crowdsourced interview reports. A higher score means the problem has been reported more often in recent X interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your X coding interview

X interviews focus heavily on array, hash-table, string problems. If you're short on time, these are the categories to prioritize. The problems on this page are sorted by frequency, so start from the top and work your way down.

Beyond solving problems, practice explaining your approach. X interviewers care about your thought process - how you break down a problem, consider edge cases, and evaluate tradeoffs between solutions. A clean O(n) solution you can explain clearly beats an O(log n) solution you can't articulate.

Looking for more companies? Browse all 458 companies in our directory, or sharpen your fundamentals with our free data structure visualizers and AI-powered DSA tutor.

Frequently Asked Questions

What coding problems does X ask in interviews?add

X has been reported to ask 45 distinct coding problems. The most common topics are array, hash-table, string. 8 are Easy difficulty, 27 are Medium, and 10 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are X coding interviews?add

Based on 45 reported problems, X interviews are slightly harder than average - 22% Hard vs 18% across all companies. 60% of questions are Medium difficulty. Focus on the high-frequency Medium problems first, then work through the Hard ones.

How should I prepare for a X coding interview?add

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, hash-table, string. Practice solving them under time pressure and explaining your approach out loud. Mock interviews with AI can simulate the real experience.

Other companies to explore

Ready to ace your X interview?

Simulate a real X coding interview with an AI interviewer. Get a scorecard with specific feedback on your problem-solving, code quality, and communication.

Simulate a X interview with AIarrow_forward