← All problemsSign in

Playing with book

Raj, Howard and Leonard are playing a game. Howard and Leonard have one book each, both identical, with a total of n pages each. Raj gives a page number p. Howard and Leonard need to get to page p in minimum page turns possible. One can either start turning pages from the front of the book or from the back. One always turns pages one at a time. When one opens the book, page 1 is always on the ri

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start