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.
This is most sort form of solution by length of this problem.
defactivityNotifications(expenditure,d):# Write your code heren=len(expenditure)mp=[0for_inrange(201)]foriinrange(d):mp[expenditure[i]]+=1c=0foriinrange(d,n):L=[None,None]t=0forjinrange(201):t+=mp[j]ifL[0]==Noneandd%2==0andt>=(d//2):L[0]=jift>=(d//2+1):L[1]=jbreakm=L[1]*2ifd%2==1elseL[0]+L[1]ifexpenditure[i]>=m:c+=1mp[expenditure[i]]+=1mp[expenditure[i-d]]-=1returnc
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 →
This is most sort form of solution by length of this problem.