Problem database last updated: June 20, 2025

LLinkedIn logo

LinkedIn Coding Interview Questions

82 problems · 16 Easy, 50 Medium, 16 Hard · Ranked #28 of 458

Difficulty breakdown

16 Easy

20% · avg 23%

50 Medium

61% · avg 59%

16 Hard

20% · avg 18%

Top topics

array
46.3%
string
24.4%
hash-table
18.3%
tree
18.3%3.3x
depth-first-search
17.1%1.9x
binary-tree
17.1%3.5x

Interview profile

Based on 82 reported problems, LinkedIn interviews are in line with industry averages - 20% Hard vs 18% overall. The majority (61%) 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, LinkedIn puts unusual emphasis on iterator (2.4% of problems, 13.5x the industry average), bitmask (2.4% of problems, 4.5x the industry average), randomized (3.7% of problems, 3.9x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (46.3%), string (24.4%), hash-table (18.3%), tree (18.3%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 82 problems

All O`one Data Structure

Solve

Design a data structure to store the strings' count with the ability to return the strings with minimum and maximum counts.

HardVery Likely
hash-tablelinked-listdesign

Word Ladder

Solve

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

HardVery Likely
hash-tablestringbreadth-first-search

Maximum Subarray

Solve

Given an integer array nums, find the subarray with the largest sum, and return its sum.

MediumVery Likely
arraydivide-and-conquerdynamic-programming

Valid Parentheses

Solve

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

EasyVery Likely
stringstack

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.

MediumVery Likely
arraydepth-first-searchbreadth-first-search

Maximum Product Subarray

Solve

Given an integer array nums, find a subarray that has the largest product, and return the product.

MediumLikely
arraydynamic-programming

Can Place Flowers

Solve

You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.

EasyLikely
arraygreedy

Search in Rotated Sorted Array

Solve

There is an integer array nums sorted in ascending order (with distinct values).

MediumLikely
arraybinary-search

Pow(x, n)

Solve

Implement pow(x, n), which calculates x raised to the power n (i.e., xn).

MediumLikely
mathrecursion

Insert Delete GetRandom O(1)

Solve

Implement the RandomizedSet class:

MediumLikely
arrayhash-tablemath

Partition to K Equal Sum Subsets

Solve

Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal.

MediumLikely
arraydynamic-programmingbacktracking

Find First and Last Position of Element in Sorted Array

Solve

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

MediumLikely
arraybinary-search

Serialize and Deserialize Binary Tree

Solve

Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitte...

HardLikely
stringtreedepth-first-search

Minimum Window Substring

Solve

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is inc...

HardLikely
hash-tablestringsliding-window

Exclusive Time of Functions

Solve

On a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n-1.

MediumLikely
arraystack

Maximum Depth of Binary Tree

Solve

Given the root of a binary tree, return its maximum depth.

EasyLikely
treedepth-first-searchbreadth-first-search

Lowest Common Ancestor of a Binary Tree

Solve

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

MediumLikely
treedepth-first-searchbinary-tree

Kth Largest Element in an Array

Solve

Given an integer array nums and an integer k, return the kth largest element in the array.

MediumLikely
arraydivide-and-conquersorting

Letter Combinations of a Phone Number

Solve

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

MediumLikely
hash-tablestringbacktracking

Isomorphic Strings

Solve

Given two strings s and t, determine if they are isomorphic.

EasyLikely
hash-tablestring

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.

MediumLikely
treedepth-first-searchbinary-search-tree

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...

MediumLikely
arraysorting

Symmetric Tree

Solve

Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).

EasyLikely
treedepth-first-searchbreadth-first-search

Valid Perfect Square

Solve

Given a positive integer num, return true if num is a perfect square or false otherwise.

EasyLikely
mathbinary-search

Kth Smallest Product of Two Sorted Arrays

Solve

Given two sorted 0-indexed integer arrays nums1 and nums2 as well as an integer k, return the kth (1-based) smallest product of nums1[i] nums2[j] where 0 <= i <...

HardLikely
arraybinary-search

Valid Number

Solve

Given a string s, return whether s is a valid number.

HardLikely
string

Count Integers in Intervals

Solve

Given an empty set of intervals, implement a data structure that can:

HardLikely
designsegment-treeordered-set

Second Minimum Node In a Binary Tree

Solve

Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the nod...

EasyLikely
treedepth-first-searchbinary-tree

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.

HardLikely
arrayhash-tablemath

Evaluate Reverse Polish Notation

Solve

You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.

MediumLikely
arraymathstack

House Robber

Solve

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from rob...

MediumLikely
arraydynamic-programming

Repeated DNA Sequences

Solve

The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.

MediumLikely
hash-tablestringbit-manipulation

Can I Win

Solve

In the "100 game" two players take turns adding, to a running total, any integer from 1 to 10. The player who first causes the running total to reach or exceed...

MediumLikely
mathdynamic-programmingbit-manipulation

Longest Palindromic Subsequence

Solve

Given a string s, find the longest palindromic subsequence's length in s.

MediumLikely
stringdynamic-programming

LRU Cache

Solve

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

MediumLikely
hash-tablelinked-listdesign

Binary Tree Level Order Traversal

Solve

Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).

MediumLikely
treebreadth-first-searchbinary-tree

Merge Two Sorted Lists

Solve

You are given the heads of two sorted linked lists list1 and list2.

EasyLikely
linked-listrecursion

Permutations

Solve

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

MediumLikely
arraybacktracking

Permutations II

Solve

Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order.

MediumLikely
arraybacktrackingsorting

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...

MediumLikely
stacktreedepth-first-search

Find K Pairs with Smallest Sums

Solve

You are given two integer arrays nums1 and nums2 sorted in non-decreasing order and an integer k.

MediumLikely
arrayheap-priority-queue

Two Sum

Solve

Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target.

EasyLikely
arrayhash-map

Merge k Sorted Lists

Solve

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

HardLikely
linked-listdivide-and-conquerheap-priority-queue

Binary Tree Zigzag Level Order Traversal

Solve

Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level...

MediumLikely
treebreadth-first-searchbinary-tree

Palindromic Substrings

Solve

Given a string s, return the number of palindromic substrings in it.

MediumLikely
two-pointersstringdynamic-programming

Text Justification

Solve

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justifie...

HardLikely
arraystringsimulation

Product of Array Except Self

Solve

Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

MediumLikely
arrayprefix-sum

Sum of Square Numbers

Solve

Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c.

MediumLikely
mathtwo-pointersbinary-search

Insert Interval

Solve

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and interv...

MediumLikely
array

Insert Delete GetRandom O(1) - Duplicates allowed

Solve

RandomizedCollection is a data structure that contains a collection of numbers, possibly duplicates (i.e., a multiset). It should support inserting and removing...

HardLikely
arrayhash-tablemath

Binary Search Tree Iterator

Solve

Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST):

MediumLikely
stacktreedesign

Minimum Deletions to Make Array Divisible

Solve

You are given two positive integer arrays nums and numsDivide. You can delete any number of elements from nums.

HardLikely
arraymathsorting

Maximum Number of Non-overlapping Palindrome Substrings

Solve

You are given a string s and a positive integer k.

HardLikely
two-pointersstringdynamic-programming

Find Largest Value in Each Tree Row

Solve

Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).

MediumLikely
treedepth-first-searchbreadth-first-search

Time to Cross a Bridge

Solve

There are k workers who want to move n boxes from the right (old) warehouse to the left (new) warehouse. You are given the two integers n and k, and a 2D intege...

HardLikely
arrayheap-priority-queuesimulation

Find K Closest Elements

Solve

Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array. The result should also be sorted in ascending order.

MediumLikely
arraytwo-pointersbinary-search

Create Binary Tree From Descriptions

Solve

You are given a 2D integer array descriptions where descriptions[i] = [parenti, childi, isLefti] indicates that parenti is the parent of childi in a binary tree...

MediumLikely
arrayhash-tabletree

Max Area of Island

Solve

You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume al...

MediumSometimes
arraydepth-first-searchbreadth-first-search

Edit Distance

Solve

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

MediumSometimes
stringdynamic-programming

Rotate List

Solve

Given the head of a linked list, rotate the list to the right by k places.

MediumSometimes
linked-listtwo-pointers

Valid Triangle Number

Solve

Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle.

MediumSometimes
arraytwo-pointersbinary-search

Min Stack

Solve

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

MediumSometimes
stackdesign

Word Ladder II

Solve

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

HardSometimes
hash-tablestringbacktracking

Shuffle an Array

Solve

Given an integer array nums, design an algorithm to randomly shuffle the array. All permutations of the array should be equally likely as a result of the shuffl...

MediumSometimes
arraymathdesign

Merge Sorted Array

Solve

You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and num...

EasySometimes
arraytwo-pointerssorting

Longest Palindromic Substring

Solve

Given a string s, return the longest palindromic substring in s.

MediumSometimes
two-pointersstringdynamic-programming

Combination Sum

Solve

Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum...

MediumSometimes
arraybacktracking

Fizz Buzz

Solve

Given an integer n, return a string array answer (1-indexed) where:

EasySometimes
mathstringsimulation

Integer to Roman

Solve

Seven different symbols represent Roman numerals with the following values:

MediumSometimes
hash-tablemathstring

Intersection of Two Arrays

Solve

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any...

EasySometimes
arrayhash-tabletwo-pointers

Longest Substring Without Repeating Characters

Solve

Given a string s, find the length of the longest substring without duplicate characters.

MediumSometimes
hash-tablestringsliding-window

House Robber IV

Solve

There are several consecutive houses along a street, each of which has some money inside. There is also a robber, who wants to steal money from the homes, but h...

MediumSometimes
arraybinary-searchdynamic-programming

Median of Two Sorted Arrays

Solve

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

HardSometimes
arraybinary-searchdivide-and-conquer

House Robber II

Solve

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in...

MediumSometimes
arraydynamic-programming

Diameter of Binary Tree

Solve

Given the root of a binary tree, return the length of the diameter of the tree.

EasySometimes
treedepth-first-searchbinary-tree

Same Tree

Solve

Given the roots of two binary trees p and q, write a function to check if they are the same or not.

EasySometimes
treedepth-first-searchbreadth-first-search

Design Add and Search Words Data Structure

Solve

Design a data structure that supports adding new words and finding if a string matches any previously added string.

MediumRare
stringdepth-first-searchdesign

Reorder List

Solve

You are given the head of a singly linked-list. The list can be represented as:

MediumRare
linked-listtwo-pointersstack

Best Time to Buy and Sell Stock

Solve

You are given an array prices where prices[i] is the price of a given stock on the ith day.

EasyRare
arraydynamic-programming

Next Permutation

Solve

A permutation of an array of integers is an arrangement of its members into a sequence or linear order.

MediumRare
arraytwo-pointers

Validate Binary Search Tree

Solve

Given the root of a binary tree, determine if it is a valid binary search tree (BST).

MediumRare
treedepth-first-searchbinary-search-tree

Minimum Time to Type Word Using Special Typewriter

Solve

There is a special typewriter with lowercase English letters 'a' to 'z' arranged in a circle with a pointer. A character can only be typed if the pointer is poi...

EasyRare
stringgreedy

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 LinkedIn interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your LinkedIn coding interview

LinkedIn interviews focus heavily on array, string, hash-table 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. LinkedIn 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 LinkedIn ask in interviews?add

LinkedIn has been reported to ask 82 distinct coding problems. The most common topics are array, string, hash-table. 16 are Easy difficulty, 50 are Medium, and 16 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are LinkedIn coding interviews?add

Based on 82 reported problems, LinkedIn interviews are in line with industry averages - 20% Hard vs 18% overall. 61% 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 LinkedIn coding interview?add

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, string, hash-table. 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 LinkedIn interview?

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

Simulate a LinkedIn interview with AIarrow_forward