There are n number of conference rooms available in a company for meetings. You need to book a meeting for a particular time slot. Write an algorithm to determine the number of conference rooms available for the meeting with given start time and end time.
Hint: any conference room with non- overlapping meeting will be selected.
I was thinking segment trees can provide O(logN) for this, but not sure thats the best approach
Yes, O(logN) per query is optimal.
If you have to schedule all the meetings, you can put all the start times and end times into a vector, sort them then traverse the sorted vector and assigning meeting rooms. Still O(NlogN) due to sorting but the constant is smaller and memory access patterns should be better than segment trees (that is faster if the data is large enough).