Got asked this neat technical problem from a startup. Not sure if it maps to a known pattern of sort on LC, but the interviewer was so kind and we treated the problem as a collaborative exercise like in the real world.
You are given a list of K people's availabilities and your goal is to see if there is a time when all K people are available
Examples:
P1: [20, 25], [0, 10]
P2: [10, 20], [25, 30]
→ False
P1: [0, 10], [20, 25]
P2: [30, 35], [5, 15]
→ True
P1: [0, 15], [20, 25]
P2: [30, 35], [5, 15]
P3: [0, 5], [10, 20], [25, 30]
-> TrueThere are several clarifying questions you are expected to ask, but I found that you didn't really need to do a fancy algorithm for this problem. I got an optimal time complexity solution with a readable 20 lines of Python
The problem felt daunting but there's a really neat angle you can tackle this problem from
Comments (1)

