Skip to main content

Netflix Coding Interview Questions

20 Netflix coding interview problems with full optimal solutions — 2 easy, 13 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 Netflix interviewer values, and a FAQ section.

Showing 20 problems of 20

  • #11mediumfrequently asked

    11. Container With Most Water

    Given an integer array of heights, find two lines that together with the x-axis form a container holding the most water. Netflix asks this to confirm you reach for two pointers and can articulate why advancing the shorter side is provably optimal.

    4 free resourcesSolve →
  • #16mediumfrequently asked

    16. 3Sum Closest

    Given an array of integers and a target, return the sum of three numbers closest to the target. Netflix asks this as the natural follow-up to 3Sum — they want sort + fix-one + two-pointer with a running 'best distance' check that you can defend.

    4 free resourcesSolve →
  • #18mediumfrequently asked

    18. 4Sum

    Given an array of n integers and a target, return all unique quadruples (a, b, c, d) summing to target. Netflix asks this to see whether you generalize the k-sum pattern recursively and handle duplicate skipping cleanly enough to avoid an O(n^4) blow-up.

    4 free resourcesSolve →
  • #22mediumfrequently asked

    22. Generate Parentheses

    Given n pairs of parentheses, generate all combinations of well-formed parentheses. Netflix asks this to test whether you can prune a backtracking search with two simple invariants (open-count and close-count) instead of generating-then-filtering.

    4 free resourcesSolve →
  • #32hardfrequently asked

    32. Longest Valid Parentheses

    Given a string with only '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Netflix asks this for the dynamic-programming round; the trick is the dp[i] recurrence using the character at i-1 to find the matching '('.

    4 free resourcesSolve →
  • #33mediumfrequently asked

    33. Search in Rotated Sorted Array

    Search a target in an array that was sorted ascending then rotated at an unknown pivot. Netflix asks this on the binary-search round — they want a single-pass O(log n) solution where you reason about which half is sorted at each step.

    4 free resourcesSolve →
  • #42hardfrequently asked

    42. Trapping Rain Water

    Given heights, compute how much water trapped between bars after rain. Netflix asks this on senior-IC loops to see whether you can articulate the two-pointer invariant (water at i depends only on min(maxLeft, maxRight)) without falling into O(n^2).

    4 free resourcesSolve →
  • #53mediumfoundational

    53. Maximum Subarray

    Given an integer array, find the contiguous subarray with the largest sum and return that sum. Netflix asks this on the warm-up screen to confirm you know Kadane's algorithm and can articulate the 'extend or restart' decision.

    4 free resourcesSolve →
  • #54mediumfrequently asked

    54. Spiral Matrix

    Given an m x n matrix, return all elements in spiral order. Netflix asks this to test whether you can manage four-boundary state without going out of bounds — the canonical 'index gymnastics' question.

    4 free resourcesSolve →
  • #55mediumfrequently asked

    55. Jump Game

    Given an array where each element is the max jump length from that index, determine if you can reach the last index. Netflix asks this on the greedy round — they want the 'track furthest reachable' one-pass solution, not DP backtracking.

    4 free resourcesSolve →
  • #56mediumcompany favorite

    56. Merge Intervals

    Given an array of intervals, merge all overlapping intervals and return the result. Netflix asks this as the canonical 'sort then sweep' problem — they want you to articulate why sorting by start unlocks the linear scan.

    4 free resourcesSolve →
  • #57mediumfrequently asked

    57. Insert Interval

    Given a sorted list of non-overlapping intervals and a new interval, insert it and merge as needed. Netflix asks this as the follow-up to Merge Intervals — they want you to leverage the pre-sorted input for a one-pass O(n) solution without re-sorting.

    4 free resourcesSolve →
  • #76hardfrequently asked

    76. Minimum Window Substring

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

    4 free resourcesSolve →
  • #79mediumfrequently asked

    79. Word Search

    Given an m x n grid of characters and a word, check whether the word exists in the grid by walking 4-directionally without reusing cells. Netflix asks this on the DFS round — they want clean backtracking with in-place visited-marking and pruning.

    4 free resourcesSolve →
  • #94easyfoundational

    94. Binary Tree Inorder Traversal

    Given the root of a binary tree, return the inorder traversal of its node values. Netflix asks this not for the recursion (everyone gets that) but for the explicit-stack and Morris-traversal follow-ups that signal real tree fluency.

    4 free resourcesSolve →
  • #98mediumfrequently asked

    98. Validate Binary Search Tree

    Determine if a binary tree is a valid BST. Netflix asks this to filter candidates who confuse 'every node is greater than its left child' (the wrong condition) with 'every node is greater than the maximum of its left subtree' (the right one).

    4 free resourcesSolve →
  • #124hardfrequently asked

    124. Binary Tree Maximum Path Sum

    Given a binary tree, find the path with the maximum sum where a path is any sequence of nodes connected by edges (no node repeats). Netflix asks this for the hard slot — the key is separating 'gain to return upward' from 'best path passing through this node'.

    4 free resourcesSolve →
  • #128mediumfrequently asked

    128. Longest Consecutive Sequence

    Given an unsorted array, find the longest run of consecutive integers (any order in the array). Netflix asks this because the obvious sort-then-scan is O(n log n) — and the question is whether you reach for the hash-set 'only start a chain at a true start' trick for O(n).

    4 free resourcesSolve →
  • #206easyfoundational

    206. Reverse Linked List

    Given the head of a singly linked list, reverse the list and return the new head. Netflix asks this on phone screens to confirm you can write both the iterative three-pointer dance and the recursive version cleanly under pressure.

    4 free resourcesSolve →
  • #295hardcompany favorite

    295. Find Median from Data Stream

    Design a data structure that supports adding numbers and querying the current median. Netflix asks this because streaming data is core to their business — they want the two-heaps solution where the max-heap holds the lower half and the min-heap holds the upper half.

    4 free resourcesSolve →
Netflix Coding Interview Questions — Full Solutions — InterviewChamp.AI