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 was overthinking this problem at first, but once I broke it down it made sense—it’s really just about finding the minimum turns from either side of the book. My Python version looks like this:
Drawing Book
You are viewing a single comment's thread. Return to all comments →
I was overthinking this problem at first, but once I broke it down it made sense—it’s really just about finding the minimum turns from either side of the book. My Python version looks like this:
def pageCount(n, p): return min(p // 2, (n // 2) - (p // 2))
Clean and efficient—sometimes the simplest logic is the most powerful! this delta key helps alot