We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I did it pretty much the same way but slightly different.
I like your chained functions in the evaluation!
functionsolve(s,d,m){letvc=[];for(leti=0;i<s.length;i++){letc=s.slice(i,i+m);// if c the size of m and d equals c's sum then keep itif((c.length===m)&&(d===c.reduce((a,p)=>p+a,0))){vc.push(c);}}returnvc.length;}
Cookie support is required to access HackerRank
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 did it pretty much the same way but slightly different. I like your chained functions in the evaluation!