You are viewing a single comment's thread. Return to all comments →
python 3
def birthday(s, d, m): chococalate = 0 total = sum(s[:m])
if total == d: chococalate += 1 for i in range(len(s)-m): total = total - s[i] + s[i+m] if total == d: chococalate +=1 return chococalate
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division
You are viewing a single comment's thread. Return to all comments →
python 3
def birthday(s, d, m): chococalate = 0 total = sum(s[:m])