You are viewing a single comment's thread. Return to all comments →
I'm really proud of mine(don't know how to optimize it though): int birthday(vector s, int d, int m) { int n = s.size(); int crit = 0;
for (int i = 0; i <= n - m; i++) { int sum = 0; for (int j = i; j < i + m; j++) { sum += s[j]; } if (sum == d) { crit++; } } return crit;
}
return crit;
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 →
I'm really proud of mine(don't know how to optimize it though): int birthday(vector s, int d, int m) { int n = s.size(); int crit = 0;
}
}