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],1]) k.append([A[i],-1]) k.sort() for i in range(2*n): ans+=k[i] cur_ans=max(cur_ans,ans) return cur_ans