You are viewing a single comment's thread. Return to all comments →
Solution in C++:
int birthday(vector<int> s, int d, int m) { int count = 0; for(int i = 0; i < s.size() - m + 1; i++) { int sum = 0; for(int j = i; j < i + m; ++j) sum += s[j]; if(sum == d) count++; } return count; }
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 →
Solution in C++: