summaryrefslogtreecommitdiff
path: root/progs/a245.py
blob: ec3d8d0b790faac0a9a5df675f069f913275b975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def find_platform(arr, dep, n): 
    arr.sort() 
    dep.sort() 
    plat_needed = 1
    result = 1
    i = 1
    j = 0
    while (i < n and j < n): 
        if (arr[i] <= dep[j]):           
            plat_needed+= 1
            i+= 1
        elif (arr[i] > dep[j]):           
            plat_needed-= 1
            j+= 1
        if (plat_needed > result):  
            result = plat_needed           
    return result