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.
- Subarray Division 1
- Discussions
Subarray Division 1
Subarray Division 1
Sort by
recency
|
253 Discussions
|
Please Login in order to post a comment
Java solution using a Queue:
This is my Java solution: Take notice of the loop ending condition, it took me more than I would've wanted to notice that I had to loop until i <= n - m, not i < n -m.
Mail: mst29310@gmail.com
Python3:
def birthday(s, d, m): res = 0 if len(s) < m: return res for i in range(len(s)): if(sum(s[i : i+m])==d): res+=1 return res