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.
functionworkbook(n,k,arr){// Write your code hereletpageNumber=1letspecialProblems=0arr.forEach(problems=>{constproblemsArr=Array.from(Array(problems).keys(),(x)=>x+1)while(problemsArr.length>0){constsplicedProblems=problemsArr.splice(0,k)if(splicedProblems.includes(pageNumber)){specialProblems+=1}pageNumber+=1}})returnspecialProblems}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Lisa's Workbook
You are viewing a single comment's thread. Return to all comments →
JS Solution :