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 8 problems of 25

  • #1easyfrequently asked

    1. Two Sum

    Find two numbers in an array that add to a target. Linear asks this as a warm-up to see if you reach for the O(n) hash-map solution immediately or stumble through O(n²) brute force first.

  • #20easyfrequently asked

    20. Valid Parentheses

    Determine whether a string of brackets is balanced. Linear uses this to see if you naturally reach for a stack and can explain the push/pop invariant clearly — a proxy for how you communicate data-structure choices.

  • #21easyfrequently asked

    21. Merge Two Sorted Lists

    Merge two sorted linked lists into one sorted list. Linear asks this as a foundational pointer problem — it directly primes the harder follow-up (Merge K Sorted Lists) and reveals whether you use a dummy head to simplify edge cases.

  • #53easyfrequently asked

    53. Maximum Subarray

    Find the contiguous subarray with the largest sum. Linear uses this to see if you know Kadane's algorithm by name and can articulate the 'restart if running sum goes negative' intuition before writing a single line of code.

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

  • #121easyfrequently asked

    121. Best Time to Buy and Sell Stock

    Find the maximum profit from a single buy-then-sell transaction. Linear uses this to see if you recognize the 'running minimum' pattern — iterating once while tracking the cheapest buy price seen so far.

  • #206easyfrequently asked

    206. Reverse Linked List

    Reverse a singly-linked list. Linear uses this to probe pointer manipulation fundamentals and to see whether you can explain both the iterative and recursive versions — and articulate which is preferred in production.

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