Google | Online Round 2 | Meeting Scheduler
Company: Google
Role: L3 (New Grad)
Interview Stage: Onsite
Location: unknown
Year: unknown
Original Post Content:
I recently had my onsite interview for a New Grad position at Google, and one of the questions I was asked was about scheduling meetings efficiently. The problem involved checking whether it is possible to attend all meetings without any conflicts.
You are given an array of meeting intervals intervals where intervals[i] = [start_i, end_i] represents the start and end time of the ith meeting. Your task is to determine if a person can attend all meetings. If any two meetings overlap, return false; otherwise, return true.
def canAttendMeetings(intervals):
intervals.sort(key=lambda x: x[0])
for i in range(1, len(intervals)):
if intervals[i][0] < intervals[i - 1][1]:
return False
return True
Not sure why I got this lmao