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

  • #23hardfrequently asked

    23. Merge K Sorted Lists

    Merge k sorted linked lists into one. Linear uses this to see if you know the min-heap approach and can articulate why it's O(n log k) — a natural step up from the easy 'Merge Two Sorted Lists' problem.

  • #42hardfrequently asked

    42. Trapping Rain Water

    Calculate the total water trapped between elevation bars. Linear asks this to see whether you progress through the intuitions — brute force → precomputed max arrays → two pointers — and can articulate why the two-pointer approach is O(1) space.

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

  • #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?

Linear Coding Interview Questions — Full Solutions — InterviewChamp.AI