Community

Discussion Board

Anonymous interview experiences, offers and career talk from frontend engineers.

anon_545913

Google L4 virtual interview experience

#google
01640

Google · L4 (5 years)

Rounds

  1. Virtual interview

Questions asked

  • Given on-call rotation schedules for multiple people, each with a unique name, start time, and end time, return a rotation table of non-overlapping time intervals showing who is on call during each interval. Exclude intervals where nobody is on call. Implement:
public static List<OncallOutput> getIntervals(List<OncallInput> input)

record OncallInput(String name, int start, int end) {}
record OncallOutput(int start, int end, List<String> names) {}

Example input:

  • Abby: [1, 10)
  • Ben: [5, 70)
  • Carla: [6, 12)
  • David: [15, 30)

Example output:

  • [1,5) → Abby
  • [5,6) → Abby, Ben
  • [6,10) → Abby, Ben, Carla
  • [10,12) → Ben, Carla
  • [12,15) → Ben
  • [15,30) → Ben, David
  • [30,70) → Ben

Tips

  • Think of it as a sweep line: collect all start/end points, sort them, and track who is active between each pair of points.

No replies yet

Markdown supported. 20 more characters needed.