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 3 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.
- #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?