Back to Go Examples

Go Interview Questions

Original, Google-style coding problems — each with a clear statement, an example, a complete Go solution, a step-by-step explanation, and complexity analysis.

Arrays / Strings / Hashing

Two Sum with Multiples

Return every unique pair of values that sums to a target, with duplicates removed. A hash-set scan that normalises and dedups pairs.

Longest Substring Without Repeating Characters

Find the longest run of distinct characters using a sliding window and a last-seen index map.

Merge Intervals (with Gaps)

Merge overlapping intervals and total the gaps between them with a sort-then-sweep pass.

Product of Array Except Self

Product of all elements except self in O(n) and without division, using a prefix pass and a suffix pass.

Trapping Rain Water

Two-pointer water trapping in O(n)/O(1), plus how the 2D height-map variant is solved with a min-heap.

Minimum Window Substring

Smallest window of s covering all of t (with duplicates) via a sliding window and a need-count map.

Group Anagrams

Bucket words by their sorted-letter signature using a hash map.

More questions across Trees / Graphs, Dynamic Programming, and Heaps / Design are being added.