Skip to main content

Linear Coding Interview Questions

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

Showing 6 problems of 25

  • #4hardcommonly asked

    4. Median of Two Sorted Arrays

    Find the median of two sorted arrays in O(log(m+n)). Linear asks this to see if you understand the binary-search-on-partition technique — a problem where the O(m+n) merge approach is obvious but the O(log) solution requires genuine insight.

  • #70easycommonly asked

    70. Climbing Stairs

    Count the number of distinct ways to climb n stairs taking 1 or 2 steps at a time. Linear asks this to see if you recognize it as Fibonacci DP and can articulate why memoization beats plain recursion — a proxy for how you think about repeated subproblems.

  • #127hardcommonly asked

    127. Word Ladder

    Find the shortest transformation sequence from beginWord to endWord, changing one letter at a time, using only dictionary words. Linear asks this to test whether you model it as BFS on an implicit graph — and whether you know the wildcard-key optimization to build adjacency lists efficiently.

  • #139mediumcommonly asked

    139. Word Break

    Determine if a string can be segmented into words from a dictionary. Linear uses this DP problem to see if you can formulate dp[i] = 'can I form s[0..i-1] from the wordDict?' and handle the substring check efficiently.

  • #297hardcommonly asked

    297. Serialize and Deserialize Binary Tree

    Design a codec that converts a binary tree to a string and back. Linear asks this to probe system design thinking in a coding context — can you design a self-describing format and implement both encode/decode symmetrically?

  • #704easycommonly asked

    704. Binary Search

    Search a sorted array in O(log n). Linear asks this to verify you can write a correct binary search without off-by-one bugs — a small problem that reveals a lot about coding precision.

Linear Coding Interview Questions — Full Solutions — InterviewChamp.AI