RepostedGoogle logo

Google · Phone screen → Onsite

In process

Google Intern Prefix Sums and Heaps: 6 Experiences (Part 3 of 8)

Software engineer · InternshipBachelor's degreeOct 2026
Shared by

Google SWE intern interviews from Aug–Sep 2026: 6 reports with heaps, BFS, prefix remainders and O(1)-space duplicates, plus memory-limit follow-ups.

At a glance

Coverage: six Google software engineering / SDE intern reports for the 2027 intern cycle, dated August 5 to September 15, 2026. Locations and results were not given.

In this series (Google 2027 intern tracker)

What came up

Half of these six reports leaned on heaps or BFS, and half pushed the base task toward larger data or tighter memory.

Topic Reports Last seen
Heaps: top K, median, BFS with a min-heap 3 of 6 Sep 2026
BFS on graphs and grids 3 of 6 Sep 2026
Scale follow-ups: memory limits and streams 3 of 6 Sep 2026
Duplicate detection with little extra space 2 of 6 Sep 2026
Prefix sums and modular remainders 1 of 6 Sep 2026
In-place matrix updates 1 of 6 Sep 2026
Monotonic stack 1 of 6 Sep 2026

Questions we found

Algorithms / Data Structures

Question Reports Last seen
Detect Duplicate Trace IDs in a Linked List 1 Sep 2026
Find the Duplicate Number 1 Sep 2026
Set Matrix Zeroes 1 Sep 2026
Shortest Subarray With a Target Remainder 1 Sep 2026
Count Visible People to the Left 1 Sep 2026
Minimum flight hops (practice) 1 Aug 2026
Sliding Window Median of Response Times 1 Aug 2026
Minimum Distance to Return a Book 1 Aug 2026
K Closest Stars from a Data Stream 1 Aug 2026

6 detailed candidate timelines, loops, and screens

Newest first. The numbers continue across the tracker.

17: Duplicate trace IDs, then a no-extra-space follow-up

Report date: September 15, 2026 · Role: SDE Intern · Stage: VO

Round 1

  1. Detect Duplicate Trace IDs in a Linked List: each node holds a string trace ID; return whether any ID appears more than once.
  2. The base answer walks the list and keeps seen IDs in a hash set.
  3. The follow-up bans extra space. Worth pinning down first: may the list be changed, is the output still a boolean, and can IDs be ordered or only compared for equality?

Round 2

  1. The candidate noted only "BFS + min-heap"; the task itself was not shared.

18: Duplicate number and matrix zeroing

Report date: September 14, 2026 · Role: SDE Intern · Stage: VO

Question 1

  1. Find the Duplicate Number: n + 1 integers with exactly one distinct duplicate; use O(1) extra space and beat O(n²) time.
  2. The follow-up dropped the "one duplicate" or "values 1 through n" assumption, so Floyd cycle detection no longer applies without restating the problem.

Question 2

  1. Set Matrix Zeroes: if a cell is zero, zero its whole row and column, in place.
  2. The follow-up made the matrix too large for memory and asked about blocks, external storage and multiple passes.

19: Prefix remainders with three follow-ups

Report date: September 11, 2026 · Role: SDE Intern · Stage: phone screen

  1. Shortest Subarray With a Target Remainder: does some nonempty contiguous subarray have a sum whose remainder mod 70001 is k?
  2. Follow-up 1 allowed negative values. Languages treat % differently, so every remainder gets normalized into [0, 70000].
  3. Follow-up 2 asked for the shortest such subarray. Keep the latest prefix index for each remainder, not only the earliest.
  4. Follow-up 3 streamed about one million values under a memory limit. With a fixed modulus, a 70001-entry array can replace the hash map, plus one rolling prefix remainder.

20: How many people each person can see to the left

Report date: September 5, 2026 · Role: Software Engineer Intern · Stage: VO

  1. Count Visible People to the Left: heights are distinct, and a person sees someone to the left when nobody between them is taller than both.
  2. Warm-up: in [1, 10, 6, 7, 9, 8, 2, 4, 3, 5], the last person sees 6 people.
  3. The follow-up asked for the count for every person. A left-to-right monotonic stack pushes and pops each value at most once: O(n) time and space.

21: Fewest flight hops, then a streaming median

Report date: August 31, 2026 · Role: SWE Intern · Stage: VO · Note: posts from August 30 and 31 describe the same rounds and count once

Round 1

  1. Cities joined by two-way flights form an unweighted graph; find the fewest hops from start to destination. Closest practice: Shortest Hop Path Between Machines.
  2. BFS solves the base task. Follow-ups: return the full route, handle disabled flights, and give the full time and space analysis.

Round 2

  1. Sliding Window Median of Response Times: response times keep arriving; return the median of the latest K.
  2. A max-heap holds the smaller half and a min-heap the larger half. The hard part is removing values that leave the window.
  3. Other follow-ups: high data volume, lower memory, duplicates and even-sized windows.

22: Return a book through a grid, then top K stars

Report date: August 5, 2026 · Role: Software Engineer Intern · Stage: VO, two rounds

Round 1

  1. Minimum Distance to Return a Book: an m × n grid has a start cell, libraries and train stations; each station reaches a library at a known extra distance.
  2. BFS from the start, then compare walking straight to a library with walking to a station and adding that station's library distance.
  3. The report said "minimum walking distance" in one place but its formula added the station distance; the practice page follows the formula.

Round 2

  1. K Closest Stars from a Data Stream, a question seen earlier in this tracker.
  2. The candidate weighed sorting against a min-heap, then chose a size-K max-heap for O(N log K) time.
  3. Tests covered K = 0, K > N and equal distances.

Patterns across the reports

  1. Bigger-data follow-ups. Three of six reports moved the base task to data that does not fit or keeps arriving: an out-of-memory matrix (18), a million streamed values (19) and high-volume response times (21).
  2. Duplicates under tight space. Reports 17 and 18 both asked for duplicate detection and then took extra space away, in a linked list (17) and an array (18).
  3. Heaps in the second round. Round 2 used heaps in three reports: a BFS + min-heap task (17), a two-heap median (21) and a size-K max-heap (22).

Common questions

What coding questions do Google 2027 SWE interns get?

In this part: duplicate trace IDs (17), find the duplicate number and set matrix zeroes (18), prefix remainders (19), visible people (20), flight hops and a sliding median (21), and a grid return-distance task with top K stars (22).

What follow-ups does Google ask in intern interviews?

Mostly scale and space: no extra memory (17, 18), data too big for memory (18), a million streamed values (19), and high volume with less memory (21).

How many rounds is the Google intern virtual onsite?

Reports 17, 21 and 22 describe two rounds; report 18 lists two questions. Report 19 was a phone screen.

Does Google ask heap questions in intern interviews?

Yes in three of six reports: a BFS + min-heap round (17), a two-heap sliding median (21) and top K with a max-heap (22).

Keep practicing

In this series: Part 1 · Part 2 · Part 3 (current) · Part 4 · Part 5 · Part 6 · Part 7 · Part 8

Sources: Anywhere useful interview info can be found.

0 total reactions. Your reactions: none.
0 comments

Comments

0

No comments yet — be the first to share what you know.