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.
defworkbook(n,k,arr):# Write your code herecurrent_page_no=0special_problem_count=0forchapterinrange(1,n+1):pages=math.ceil(arr[chapter-1]/k)current_problems=0whilepages>0:current_page_no+=1problems_on_current_page=kif(arr[chapter-1]-current_problems)>kelsearr[chapter-1]-current_problemsifcurrent_page_no>current_problemsandcurrent_page_no<=(current_problems+problems_on_current_page):special_problem_count+=1current_problems+=problems_on_current_pagepages-=1returnspecial_problem_count
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 →