LinkedIn logo

LinkedIn Interview Questions

17 practice questions for LinkedIn technical interviews

coding Easy Verified

Balanced Parentheses


Category: String coding problem
Configuration files at LinkedIn are written in JSON, YAML, and HOCON formats. Malformed config files can bring down multiple services, so validators...
Input: String
Output: Printed output
coding Medium Verified

Words From Phone Number


Category: String coding problem
A standard phone keypad maps digits to letters as follows: ` 2 -> a, b, c 3 -> d, e, f 4 -> g, h, i 5 -> j, k, l 6 -> m, n, o 7 -> p, q, r, s 8 ->...
Input: List
Output: Array
coding Medium Verified

Circular Signal Window


Category: Array coding problem
You are given a circular array signal of 0s and 1s representing antenna readings logged in sequence, where 1 means good signal and 0 means...
Input: Array
Output: Integer
coding Easy Verified

Active Sprint Filter


Category: Graph coding problem
A project tracking system logs team activity throughout the workday. Each log entry has the format "teamId action timestamp", where action is...
Input: Graph (nodes and edges)
Output: Printed output
coding Medium Verified

Dependency Task Executor


Category: Graph coding problem
A build system manages pipeline steps where each step may depend on other steps completing first. Implement the BuildPipeline class:...
Input: Graph (nodes and edges)
Output: Computed result
coding Medium Verified

Daily Branch Pruning


Category: Tree coding problem
A file system manages a directory tree. Each day, all leaf directories (those with no child directories) are simultaneously removed. Directories that...
Input: Array
Output: Array
coding Hard Verified

[OA] Minimum Weight Ceiling Path


Category: Graph coding problem
A network topology connects n servers labeled 1 to n. Each connection is a bidirectional link with a bandwidth cost. A network engineer needs...
Input: Graph (nodes and edges)
Output: Integer
coding Hard Verified

Priority Cache System


Category: String coding problem
A CDN (Content Delivery Network) maintains a fixed-capacity cache of web content. Each content item has an associated priority score. When the cache...
Input: String
Output: Integer
coding Medium Verified

Distribution Center Placement


Category: Array coding problem
A logistics company is expanding its distribution network along a single highway. You are given an array of integers locations representing the...
Input: Array of integers
Output: Computed result
coding Medium Verified

Manual String Substitution


Category: String coding problem
A template engine needs to substitute all occurrences of a pattern in a template string with a replacement string, without using any built-in...
Input: String
Output: Printed output
coding Hard Verified

Combine N-ary Trees


Category: Tree coding problem
You are given the roots of two N-ary organization charts, each representing a hierarchical department structure. Every node has an integer...
Input: List
Output: Computed result
coding Medium Verified

Closest Value Pair


Category: Array coding problem
An inventory system has two sorted product catalogs A and B. Each value in the catalog represents a product size. Find a pair [a, b] where a...
Input: Array
Output: Computed result
coding Medium Verified

Digit Replacement Maximizer


Category: String coding problem
A numeric optimization system performs exactly k substitution operations on a number string s. In each operation, choose any digit in s that is...
Input: String
Output: Computed result
system design Senior api design

[OA] Twitter Feed — Design a system to display recent activities for LinkedIn users

LinkedIn needs a feature similar to Twitter feeds, where users can see recent activities of their connections. This involves multiple classes coordinating data retrieval and display.
Problem statement: Design a class TwitterFeed that handles user activity feeds and allows users to follow/unfollow other users.
- Input: Methods to postTweet(userId: int, tweet: str), getNewsFeed(userId: int), follow(followerId: int, followeeId: int), and unfollow(followerId: int, followeeId: int).
- Output: List[str] for getNewsFeed, containing up to 10 most recent tweets from the user and their followed users.
- Constraints:
- UserIds are in the range of 1 to 10^4
- Tweet content can be up to 140 characters.
system design Senior caching

[OA] LRU Cache — Design a caching mechanism to store recently accessed user profiles

To enhance performance, LinkedIn requires a caching system that follows the LRU (Least Recently Used) principle for user profile data retrieval.
Problem statement: Design and implement a class LRUCache that supports the following operations:
- get(key: int) -> int: Returns the value of the key if the key exists, otherwise return -1.
- put(key: int, value: int): Update the value of the key if the key exists, or add the key-value pair if the key does not exist. When the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.
- Input: capacity - maximum number of items the cache can hold.
- Output: int for get, no output for put.
Example 1:
Input: ["LRUCache", "put", "put", "get", "put", "get", "get", "put", "get"], [[2], [1, 1], [2, 2], [1], [3, 3], [2], [4], [1], [3]]
Output: [null, null, null, 1, null, 2, -1, null, 3]
Explanation: The cache operates under the mentioned rules and examples.
Constraints:
- 1 <= capacity <= 3000
- 0 <= key, value <= 10^4
coding Hard graph

[OA] Depth First Search — Find all connected components in a network of LinkedIn profiles

LinkedIn's algorithm can identify connections between users to enhance networking. We want to find all connected components given a list of connections between user profiles.
Problem statement: Given an integer n representing the number of profiles and a list of connections edges, return the connected components across profiles.
- Input: int n, edges defined as a list of pairs representing connections.
- Output: List[List[int]] — a list that contains all connected components, with each component being a list of profile IDs.
Example 1:
Input: n = 5, edges = [[0, 1], [1, 2], [3, 4]]
Output: [[0, 1, 2], [3, 4]]
Explanation: Profile 0 is connected to 1 and 2; profile 3 is connected to 4.
Example 2:
Input: n = 4, edges = [[0, 1], [1, 0], [2, 3]]
Output: [[0, 1], [2, 3]]
Constraints:
- 0 <= n <= 2000
- 0 <= edges.length <= n * (n - 1) / 2
coding Hard sliding window

[OA] Sliding Window — Implement a feature to find the longest substring without repeating characters in profile descriptions

LinkedIn users often write descriptive profiles, and analyzing these descriptions can help in improving user engagement. The goal is to identify the longest substring from a given profile description where no characters are repeated.
Problem statement: Given a string s, return the length of the longest substring without repeating characters.
- Input: string s
- Output: int — length of the longest substring without repeating characters.
Example 1:
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Constraints:
- 0 <= s.length <= 5 * 10^4
- s consists of English letters, digits, symbols, and spaces.

Start practicing LinkedIn questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free