You are viewing a single comment's thread. Return to all comments →
Python 3 Solution
def birthday(s, d, m): selected_sum = sum(s[:m]) num_of_ways = 0 if selected_sum == d: num_of_ways += 1 for i in range(len(s) - m): selected_sum += s[i + m] - s[i] if selected_sum == d: num_of_ways += 1 return num_of_ways
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 Solution