You are viewing a single comment's thread. Return to all comments →
I guess it is the simplest to understand m is the length of vector d is the sum of consecutive no.
int birthday(vector<int> s, int d, int m) { int req=0; for(int i=0;i<s.size()-m+1;i++){ int count=0; for(int j=0;j<m;j++){ count+=s[i+j]; }if(count==d){ req++; } }return req; }
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 guess it is the simplest to understand m is the length of vector d is the sum of consecutive no.