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.
ans=[]
for i in range(0,len(s),1):
if (sum(s[i:i+m])) == d:
ans.append(s[i:i+m])
return len(ans)
So range() function here makes the window slide 1 at a time. as m is the number of bars we need to give we are slicing the array s from i to i+m and then adding the sum of the sliced values. Hope you got the point.
Subarray Division
You are viewing a single comment's thread. Return to all comments →
This is basically the below code