Join Regular Classroom : Visit ClassroomTech

MountBlue Solution | !On Off Code | Codewindow.in

Write the following code in the def portion and the rest are unchanged | Python 3

#codewindow.in

def endGame(operations):
    p=10**5
    m=len(operations)
    b=[0]*(p+1)
    ans=[False]+m
    for i in range (m):
        f=operations[i][0]-1
        e=operations[i][1]
        b[f]+=1
        b[e]-=1
        
    for i in range(1,p):
        b[i]+=b[i-1]
    ans=0
    for i in range (p):
        ig b[i]%2!=0:
            ans+=(i+1)
    return ans
#end

Follow us

Also Checkout