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.
- Drawing Book
- Discussions
Drawing Book
Drawing Book
Sort by
recency
|
135 Discussions
|
Please Login in order to post a comment
Great explanation of the page-turning problem! For more interesting and easy-to-follow recipes like this, check out Recipe Lookbook.
Java
def pageCount(n, p): # Write your code here return min(p//2,(n//2)-(p//2))
one liner solution in python return int(min(p-0,(n+1 if n%2==0 else n)-p)/2)