5 ms·
And if you don't know exactly how many pages there are? Normaly you would just do binary search.
by vincnetas 6y ago
And if you don't know exactly how many pages there are? Normaly you would just do binary search.
- jonsen 6y agoIf pages are numbered, the largest page number is still on last page. Just look there. Or alternatively: The first step of your binary search is to look at the page number on the flip side of page 1 and determine to flip the stack or not.