Google L4 virtual interview experience

Google L4
Level: 4
Education: Masters
Years of Experience: 5
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 getIntervals(List input)

with:
record OncallInput(String name, int start, int end) {}
record OncallOutput(int start, int end, List 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