Skip to main content

Google Coding Interview Questions

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

Showing 13 problems of 26

  • #3mediumfrequently asked

    3. Longest Substring Without Repeating Characters

    Given a string, return the length of the longest substring with all unique characters. Google asks this to test sliding-window intuition and whether you can articulate why O(n) is achievable when the naive answer is O(n^3).

  • #5mediumfrequently asked

    5. Longest Palindromic Substring

    Find the longest palindromic substring in a given string. Google asks this to test whether you reach for the expand-around-center technique and can articulate why it's O(n^2) instead of the naive O(n^3).

  • #33mediumfrequently asked

    33. Search in Rotated Sorted Array

    Search for a target in a sorted array that has been rotated at some unknown pivot. Google asks this to test whether you can apply modified binary search and reason about which half is sorted at each step.

  • #53mediumfrequently asked

    53. Maximum Subarray

    Find the contiguous subarray with the largest sum. Google asks this to see whether you arrive at Kadane's algorithm and can articulate the invariant: at index i, the best subarray ending here is either the current element alone or the current element extending the previous best.

  • #91mediumfrequently asked

    91. Decode Ways

    Given a digit string, count the ways it can be decoded as letters (A=1...Z=26). Google asks this to test whether you reach for 1D DP and can handle the edge cases around '0' digits which can't stand alone.

  • #128mediumfrequently asked

    128. Longest Consecutive Sequence

    Given an unsorted array, find the length of the longest consecutive elements sequence. The catch: Google requires O(n) — sorting (O(n log n)) is the wrong answer and you must reach for the hash-set 'start a chain only from the smallest element' trick.

  • #139mediumfrequently asked

    139. Word Break

    Given a string and a dictionary, return true if the string can be segmented into dictionary words. Google asks this to test whether you reach for DP and can articulate why a hash set of words + a boolean DP table gives O(n^2) instead of the exponential backtracking blowup.

  • #146mediumfrequently asked

    146. LRU Cache

    Design a cache that evicts the least recently used key when full. Google asks this to test whether you reach for the doubly-linked-list + hash map combo and can articulate why neither data structure alone gives you O(1) for both get and put.

  • #207mediumfrequently asked

    207. Course Schedule

    Given courses and prerequisites, return true if all courses can be finished. Google asks this to test whether you reach for cycle detection in a directed graph and can articulate the difference between DFS-with-coloring and Kahn's BFS topological sort.

  • #253mediumfrequently asked

    253. Meeting Rooms II

    Given meeting intervals, return the minimum number of rooms required. Google asks this to test whether you reach for a min-heap of end times or the sweep-line / two-pointer counter, and can articulate the start/end event framing.

  • #300mediumfrequently asked

    300. Longest Increasing Subsequence

    Return the length of the longest strictly increasing subsequence. Google asks this to test whether you reach for O(n log n) via patience sorting / binary search rather than stopping at the textbook O(n^2) DP.

  • #380mediumfrequently asked

    380. Insert Delete GetRandom O(1)

    Design a data structure that supports insert, remove, and getRandom — all in O(1) average. Google asks this to test whether you can combine a hash map (for O(1) lookup) with a dynamic array (for O(1) random access), and to see if you handle the 'swap to end before pop' trick for O(1) removal.

  • #399mediumfrequently asked

    399. Evaluate Division

    Given variable equations like a/b = 2.0 and b/c = 3.0, answer queries like a/c. Google asks this to test whether you can model the equations as a weighted graph and reach for DFS or union-find.

Related interview-prep guides

Interview Platforms

HireVue Tech Interview Guide: The 2026 Playbook for Async Video Rounds

HireVue is the category-leading async video interview platform. Candidates record answers solo, on the clock, and a combined AI-plus-human review layer scores the recording days later. For 2026 tech jobseekers, the format is different enough from live interviews to need its own playbook. This guide is that playbook.

Interview Platforms

HackerRank Tech Interview Guide 2026: What It Tests, How It Tracks You, and the Modern Setup

HackerRank is still the volume leader in first-round technical screens for 2026 tech hiring. A browser-sandboxed coding environment that logs every keystroke, paste event, and tab-focus change inside its own tab. This guide covers what it tests, the boundary of what it can and cannot detect, and how a modern desktop setup pairs with a HackerRank session without leaking into the screen-share.

Interview Platforms

Karat Technical Interview Guide 2026: How the Third-Party Loop Actually Works

Karat is technical-interview-as-a-service. Karat-employed engineers run the technical loop for the hiring company in Karat's own recorded video and coding environment. The dynamic is different from an in-house interview: the interviewer is a contractor, not a future teammate, the rubric is fixed, the session is recorded for asynchronous review, and the hiring team's engineers watch the playback a day later. This guide is the practical map of how that loop works in 2026 and how a modern desktop setup runs alongside it.

Google Coding Interview Questions — Full Solutions — InterviewChamp.AI