You are viewing a single comment's thread. Return to all comments →
static int birthday(List s, int d, int m) { int sum = 0; int count = 0; int res = 0;
for(int x = 0; x < s.Count-m+1; x++) { for(int y = x; y < s.Count; y++) { sum += s[y]; count++; if (sum == d && count==m) { sum = 0; count = 0; res++; break; } else if (sum > d) { sum = 0; count = 0; break; } } } return res; }
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 →
static int birthday(List s, int d, int m) { int sum = 0; int count = 0; int res = 0;