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 realised that each page can have at most one special problem, and that the minimum number of special problems is always 1 (chapter 1, page 1, problem 1).
So I got the bound: (1 <= answer <= total pages)
Or more generally: (1 <= answer <= total pages <= total problems)
Basically my algorithm loops over every page and checks if the page number lies within the problem number range of that page. Here's my Python solution:
Lisa's Workbook
You are viewing a single comment's thread. Return to all comments →
I realised that each page can have at most one special problem, and that the minimum number of special problems is always 1 (chapter 1, page 1, problem 1).
So I got the bound: (1 <= answer <= total pages)
Or more generally: (1 <= answer <= total pages <= total problems)
Basically my algorithm loops over every page and checks if the page number lies within the problem number range of that page. Here's my Python solution: