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.
int workbook(int n, int k, int arr_count, int* arr) {
int special_numbers=0;
int page_numbers=0;
int problem_number;
for(int chapter_number=0;chapter_number
for(problem_number=0;problem_number<arr[chapter_number];problem_number++){
if((problem_number+1)==page_numbers){
special_numbers++;
}
if((problem_number+1)%k==0){ //condition to the page turn
page_numbers++;
}
}
if((problem_number)%k==0){// condition whether page turns, but no problem is there, then we have reduce the page number
page_numbers--;
}
}
return special_numbers;
}
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 →
int workbook(int n, int k, int arr_count, int* arr) { int special_numbers=0; int page_numbers=0; int problem_number; for(int chapter_number=0;chapter_number
}