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.
Fastest Python solution!!!
Solution uses sliding window or queue (which ever makes it easier for you to think about this problem.)
Solution also uses some savvy indexing math.
defbirthday(s,d,m):# Write your code herecount=0total=sum(s[:m])iftotal==d:count+=1foriinrange(m-1,len(s)-1):total+=s[i+1]-s[i+1-m]iftotal==d:count+=1returncount
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division 1
You are viewing a single comment's thread. Return to all comments →
Fastest Python solution!!! Solution uses sliding window or queue (which ever makes it easier for you to think about this problem.) Solution also uses some savvy indexing math.