educative.io

It can be done in O(n) rather than O(NlogN)

If we

  1. get the end of last meeting
  2. Create a bool array - isBooked
  3. Iterate other meetings array and try marking time to true.
  4. Break at the very first occurrence where it’s already booked and program is trying to double book.
  5. If it’s End of the meetings array then successful.

Could you share a working implementation of what you mean? I also thought it could be done in O(n) but had a completely different idea.