question:
given a list of tickets(start_time, end_time) and a number N. find how many active tickets were there at time t where 0<= t < N.
my approach:
- sort tickets by start_time and then end_time in asc order
- use two pointers i=0, j=0 to create a window
- for any time t, size of window will give no of active tickets for that time
- for time t+1 move pointer j to include more tickets and move pointer i to remove expired tickets
time complexity: O(nlogn)
I was able to code and explain the approach. inteviewer even said "all the best for your loop round", but got a call that feedback was -ve.
Comments (8)


