You are viewing a single comment's thread. Return to all comments →
JS:
function birthday(s, d, m) { let count= 0; for(let i= 0; i<s.length; i++){ let slice= s.slice(i, i+m); let addedSlice= slice.reduce( (acc, curr) => { return acc + curr}, 0); if(addedSlice == d){ count += 1; if((i+1+m) > s.length) break; }; }; return count; };
Seems like cookies are disabled on this browser, please enable them to open this website
Subarray Division 1
You are viewing a single comment's thread. Return to all comments →
JS: