Coding rounds
Google coding rounds
5 timed coding challenges drawn from real loops. Submit a solution to see your test pass rate and AI feedback.
Two Sum
Given an array of integers `nums` and an integer `target`, return the indices of the two numbers that add up to `target`. Each input has exactly one solution, and you may not use the same element twice. Aim for O(n) time using a hash map.
Open
Merge Intervals
Given an array of `intervals` where `intervals[i] = [start, end]`, merge all overlapping intervals and return an array of the non-overlapping intervals that cover all the intervals in the input. Sort by start, then sweep.
Open
Number of Islands
Given an `m x n` 2D grid of "1" (land) and "0" (water), return the number of islands. An island is surrounded by water and formed by connecting adjacent land cells horizontally or vertically. Use BFS/DFS flood fill.
Open
Word Break
Given a string `s` and a dictionary `wordDict`, return true if `s` can be segmented into a space-separated sequence of one or more dictionary words. Words may be reused. Use dynamic programming over prefixes (O(n²) with a set).
Open
LRU Cache
Design a data structure for a Least Recently Used (LRU) cache with capacity `k`. Implement `get(key)` and `put(key, value)` in O(1) average time. When capacity is exceeded, evict the least recently used key. A JS `Map` preserves insertion order, which you can exploit for recency.
Open