Skip to main content

LinkedIn Coding Interview Questions

32 LinkedIn coding interview problems with full optimal solutions — 4 easy, 21 medium, 7 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an LinkedIn interviewer values, and a FAQ section.

  • #20easyfoundational

    20. Valid Parentheses

    Determine whether a string of brackets is correctly matched using a stack — LinkedIn uses this as a 5-minute coding warm-up, often paired with a JSON or template-syntax validation scenario to tie the abstract stack to the profile-rendering pipeline that parses nested markup in member summaries.

  • #56mediumfoundational

    56. Merge Intervals

    Merge all overlapping intervals in a list into non-overlapping ranges — LinkedIn uses this pattern to consolidate overlapping employment date ranges in member profiles and to compact calendar availability windows, making it one of the most practically grounded problems in their interview bank.

  • #91mediumfoundational

    91. Decode Ways

    Count the number of ways to decode a digit string where each letter maps to 1–26 — LinkedIn asks this DP problem to test whether you can enumerate valid interpretation paths under constraints, the same combinatorial reasoning used in their NLP pipeline for ambiguous entity recognition in profile text.

  • #128hardfoundational

    128. Longest Consecutive Sequence

    Find the length of the longest run of consecutive integers in an unsorted array in O(n) time — LinkedIn uses this problem to check whether you can design set-based O(n) algorithms, the same reasoning they apply to detecting unbroken skill-progression sequences in member credential timelines.

  • #133mediumfoundational

    133. Clone Graph

    Deep-copy a connected undirected graph using BFS and a hash map — a near-literal model of how LinkedIn clones member connection graphs across data centers, making it one of the most contextually on-brand questions in their rotation.

  • #199mediumfoundational

    199. Binary Tree Right Side View

    Return the values visible when looking at a binary tree from the right side — LinkedIn applies this BFS-by-level pattern to render hierarchical org-chart data, surfacing only the rightmost node at each reporting tier, a frequent warm-up before harder tree design questions.

  • #200mediumfoundational

    200. Number of Islands

    Count connected landmasses in a grid using BFS or DFS — LinkedIn uses this to probe how you think about connected-component discovery, the same graph reasoning behind mapping professional networks and finding isolated clusters in the member graph.

  • #207mediumfoundational

    207. Course Schedule

    Determine if a set of courses with prerequisites can all be finished — this is cycle detection on a directed graph, the exact algorithm LinkedIn runs to validate skill-path dependency chains and surface circular credential requirements in their learning platform.

  • #238mediumfoundational

    238. Product of Array Except Self

    Compute the product of every array element except the current one — without division — using prefix and suffix passes. LinkedIn asks this to test whether you can reason about O(n) algorithms under artificial constraints, mirroring how their data pipeline computes per-member aggregates that exclude the member's own data.

  • #253mediumfoundational

    253. Meeting Rooms II

    Find the minimum number of meeting rooms needed to schedule all intervals without overlap — LinkedIn applies this algorithm to allocate recruiter calendar slots and to detect overlapping employment periods in member profiles, one of their most-cited interval problems.

  • #295hardfoundational

    295. Find Median from Data Stream

    Design a data structure that computes the median of an ever-growing stream using two heaps — LinkedIn runs this pattern to rank feed items by engagement score in real time, where you need a running median without resorting the entire dataset on every new signal.

  • #347mediumfoundational

    347. Top K Frequent Elements

    Return the k most frequent elements from an array — this is the algorithm behind LinkedIn's 'People You May Know' ranking and trending job suggestion surfaces, where you need the top-K signals from a frequency count without sorting the entire dataset.

  • #1easyfoundational

    1. Two Sum

    Two Sum is LinkedIn's canonical 10-minute warm-up: given an integer array and a target, return the indices of the two numbers that add up to target. The interviewer is grading your willingness to narrate brute-force first, then move to the hash-map optimization.

    4 free resourcesSolve →
  • #47mediumfrequently asked

    47. Permutations II

    Given a collection of integers (possibly with duplicates), return all unique permutations. LinkedIn asks this on the backtracking round — they want the sort-then-skip-duplicates pattern, not generate-then-dedupe.

    4 free resourcesSolve →
  • #68hardcompany favorite

    68. Text Justification

    Given an array of words and a max line width, fully justify each line (with the last line left-aligned). LinkedIn asks this for the hard slot because it's the canonical 'simulate carefully' problem — no clever algorithm, just precise spacing distribution.

    4 free resourcesSolve →
  • #76hardfrequently asked

    76. Minimum Window Substring

    Given strings s and t, return the smallest substring of s that contains every character of t (with multiplicity). LinkedIn asks this on senior loops because the canonical sliding-window template is small to write but easy to break on duplicates.

    4 free resourcesSolve →
  • #126hardfrequently asked

    126. Word Ladder II

    Given begin and end words and a dictionary, return ALL shortest transformation sequences. LinkedIn asks this for the hardest BFS slot — the trick is to do BFS for distances first, then DFS to reconstruct paths only following shorter-distance neighbors.

    4 free resourcesSolve →
  • #127hardfrequently asked

    127. Word Ladder

    Given begin and end words and a dictionary, return the length of the shortest transformation sequence where each step changes one letter and produces a dictionary word. LinkedIn asks this on the BFS round — they want the wildcard-bucket preprocessing trick for O(N * L^2).

    4 free resourcesSolve →
  • #150mediumcompany favorite

    150. Evaluate Reverse Polish Notation

    Given an array of tokens in Reverse Polish (postfix) notation, evaluate and return the result. LinkedIn asks this because it's the textbook stack problem — they want clean push-on-operand, pop-pop-apply-push-on-operator without any parsing distractions.

    4 free resourcesSolve →
  • #152mediumfrequently asked

    152. Maximum Product Subarray

    Given an integer array, find the contiguous subarray with the largest product. LinkedIn asks this on the DP round because negatives turn Kadane on its head — you need to track BOTH min and max running products to handle sign flips.

    4 free resourcesSolve →
  • #208mediumcompany favorite

    208. Implement Trie (Prefix Tree)

    Implement a Trie with insert, search, and startsWith. LinkedIn asks this because it's the foundation of their typeahead and autocomplete features — they want a clean node-with-children-map structure and the isEnd boolean.

    4 free resourcesSolve →
  • #230mediumfrequently asked

    230. Kth Smallest Element in a BST

    Given a BST and integer k, return the kth smallest value. LinkedIn asks this on the BST round — they want the iterative inorder with early-stop, AND the follow-up answer if the tree is modified frequently (augment with subtree size).

    4 free resourcesSolve →
  • #243easycompany favorite

    243. Shortest Word Distance

    Given an array of strings and two words, return the shortest distance between two indices where these words appear. LinkedIn asks this as the entry point to their signature Shortest Word Distance family — they want the single-pass O(n) solution with two index trackers.

    4 free resourcesSolve →
  • #244mediumcompany favorite

    244. Shortest Word Distance II

    Same as Shortest Word Distance but with many queries. LinkedIn asks this to test whether you can amortize cost across queries — pre-bucket indices by word, then run a merge-like two-pointer walk per query.

    4 free resourcesSolve →
  • #245mediumcompany favorite

    245. Shortest Word Distance III

    Same as Shortest Word Distance but word1 might equal word2 — meaning you need the closest pair of occurrences of the same word. LinkedIn asks this as the culminating follow-up to the series, testing whether you spot the asymmetric case before writing code.

    4 free resourcesSolve →
  • #277mediumcompany favorite

    277. Find the Celebrity

    Given n people and a knows(a, b) API, find THE celebrity — someone known by everyone but who knows no one. LinkedIn asks this because it's the canonical 'elimination by partial order' problem — n calls find a candidate, n calls verify.

    4 free resourcesSolve →
  • #297hardfrequently asked

    297. Serialize and Deserialize Binary Tree

    Design an algorithm that serializes a binary tree to a string and back. LinkedIn asks this on senior loops because the preorder-with-nulls + queue-based recursive parse is the cleanest pair you can write under interview pressure.

    4 free resourcesSolve →
  • #339mediumcompany favorite

    339. Nested List Weight Sum

    Given a nested list of integers, return the sum of all integers weighted by their depth. LinkedIn asks this on the recursion round — they want clean DFS or BFS code that uses the provided NestedInteger interface without unpacking it eagerly.

    4 free resourcesSolve →
  • #364mediumcompany favorite

    364. Nested List Weight Sum II

    Same as Nested List Weight Sum but the weighting is INVERTED — deepest leaves are weight 1 and the root is the heaviest. LinkedIn asks this as the trickier follow-up; the clean solution is a 'cumulative sum at each depth' trick that avoids two passes.

    4 free resourcesSolve →
  • #366mediumcompany favorite

    366. Find Leaves of Binary Tree

    Given a binary tree, collect its leaves and remove them, then repeat. Return the order of removals. LinkedIn asks this because the elegant solution isn't iterative removal — it's a 'height from leaf' DFS that buckets each node by its eventual removal layer.

    4 free resourcesSolve →
  • #605easyfrequently asked

    605. Can Place Flowers

    Given a flowerbed (0s and 1s, no two adjacent 1s) and a number n, return whether you can plant n new flowers without breaking the no-adjacent rule. LinkedIn asks this as the greedy warm-up — they want clean per-cell checks with no boundary bugs.

    4 free resourcesSolve →
  • #797mediumfrequently asked

    797. All Paths From Source to Target

    Given a DAG with n nodes labeled 0 to n-1, find all possible paths from node 0 to node n-1. LinkedIn asks this on the graph traversal round — they want clean DFS with path tracking, no DP needed (because it's a DAG and paths could be exponential).

    4 free resourcesSolve →

Related interview-prep guides

Interview Platforms

HackerRank Tech Interview Guide 2026: What It Tests, How It Tracks You, and the Modern Setup

HackerRank is still the volume leader in first-round technical screens for 2026 tech hiring. A browser-sandboxed coding environment that logs every keystroke, paste event, and tab-focus change inside its own tab. This guide covers what it tests, the boundary of what it can and cannot detect, and how a modern desktop setup pairs with a HackerRank session without leaking into the screen-share.

Interview Platforms

Karat Technical Interview Guide 2026: How the Third-Party Loop Actually Works

Karat is technical-interview-as-a-service. Karat-employed engineers run the technical loop for the hiring company in Karat's own recorded video and coding environment. The dynamic is different from an in-house interview: the interviewer is a contractor, not a future teammate, the rubric is fixed, the session is recorded for asynchronous review, and the hiring team's engineers watch the playback a day later. This guide is the practical map of how that loop works in 2026 and how a modern desktop setup runs alongside it.

Interview Platforms

Microsoft Teams for Tech Interviews in 2026: The Complete Candidate Guide

Microsoft Teams is the default interview surface at any company running Office 365: Fortune 500, finance, healthcare, government tech, legacy enterprise. The recording-and-transcript reality changes the threat model versus Zoom, but the OS-level boundary that protects a modern desktop AI setup is the same. This is the candidate-side guide to running a Teams interview in 2026.

LinkedIn Coding Interview Questions — Full Solutions — InterviewChamp.AI