Google Interview Experience

Anonymous User
510
Jul 29, 2025
Jul 29, 2025

Hi folks,

Just wanted to share my Google Interview experience since the discussions here have helped me a lot!

Interview Overview

It consisted of 2 rounds, both of which were DSA-based.


Round 1

Problem:
You have N people arriving and C empty rooms. Each person needs a room for S amount of time. You're given an integer array start_times[] representing when each person arrives. Write a function to find the minimum time required to complete everyone's needs.

Example:

start_times = [1, 3, 6], C = 2, S = 6
Expected Output = 13

Explanation:

  • Person 1 arrives at time 1 → Assigned Room 1 → Ends at 7
  • Person 2 arrives at time 3 → Assigned Room 2 → Ends at 9
  • Person 3 arrives at time 6 → Waits for Room 1 to free at time 7 → Ends at 13

So, the minimum total time needed is 13.

Hint:
Use a priority queue (min-heap) to store end times of room usage. If all rooms are busy, wait for the room that becomes free the earliest.


Follow-Up 1:
Now, find the minimum number of rooms needed to complete all tasks in the least possible time (i.e., the best case completion time).

Hint:
We can perform binary search on the number of rooms.


Round 2

This round included a series of graph-related problems, all fairly straightforward.


Problem 1:
You’re given N cities and M undirected roads connecting them. Also, you're given a list of special cities and a source node (S).
Find the shortest distance from S to the nearest special city.


Follow-Up 1:
Now, you're also given a destination city D.
Find the shortest path from S to D that passes through at least one special city.


Follow-Up 2:
Now, find the shortest path from S to any special city, but this time the path must pass through city D.


Follow-Up 3:
You're also given a list of dangerous cities you want to avoid.
Find the shortest path from S to D such that you do not pass through any city from the danger list.


That's it! Hope this helps someone preparing. Let me know if you'd like help discussing solutions to any of these problems too. 🙂

Please Upvote if it helped you

Comments (5)