Easy to understand 0(2*n) time and 0(2*n)


#1

first how we apply a greedy approach??

Here if look closely then we look at the arrival time of each meeting
1 if we see that if there exist a departure time which is smaller than the next arrival time then there is no need to allocate a separate room for it.
2 Based on this i have given a token +1 for entery and -1 for exit and sorted that array in order to know does first condition exist or not

here is the code

    ans=0
    n=len(A)
    k=[]
    cur_ans=0
    for i in range(n):
        k.append([A[i][0],1])
        k.append([A[i][1],-1])
    k.sort()  
    for i in range(2*n):
        ans+=k[i][1]
        cur_ans=max(cur_ans,ans)
    return cur_ans