We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defactivityNotifications(arr,d):# Write your code hereimportbisectfromitertoolsimportcountc=count()period=sorted(arr[:d])s=0fori,finzip(c,range(d,len(arr))):#print(i,f,arr[i],arr[f])ifd%2==0:medi=(period[d//2-1]+period[d//2])/2else:medi=period[d//2]ifarr[f]>=medi*2:s+=1i=bisect.bisect(period,arr[i])period.pop(i-1)bisect.insort(period,arr[f])returns
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Fraudulent Activity Notifications
You are viewing a single comment's thread. Return to all comments →
python