educative.io

Solution description is wrong?


From the “Solution” section (can’t attach the link bc of links limit):

One simple solution can be to put all employees’ working hours in a list and sort them on the start time. Then we can iterate through the list to find the gaps.

Looks like this solution doesn’t work (unlike the suggested optimal solution).
Example:
Employee1: [1, 5]
Employee2: [1, 2], [3, 5]

Both employees working hours sorted by start:
[1, 5], [1, 2], [3, 5]

Result: gap is found: [2,3], however it shouldn’t be found.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/5118951610646528

Hi Danchik!

Can you please share your solution code you used to solve the problem according to the given description?

Thank you!