In the given solution, the provided time complexity is O(nlogk). However, the actual time complexity should be nklog(nk) because all timeslots of each employee’s time slots are added. Therefore, it sorts based on the nk size of results instead of k employees(1 timeslot/employee).
Could you confirm the most optimal time complexity and explain why the heap size is k instead of nk, please?
Thanks,
Grace