Hackerrank – Drawing Book

Hackerrank – Problem Statement

A description of the problem can be found on Hackerrank.

Solution

The equation to calculate no. of draws, when I started from the front of the book:

    \[draws = p / 2\]

no. of draws, when I started from the back of the book:
if

    \[n\]

is even

    \[n' = n\]

else

    \[n' = n + 1\]

    \[draws = (n' - p) / 2\]

I created solution in:

All solutions are also available on my GitHub profile.

Scala

Java

Java

Leave a Reply

Your email address will not be published. Required fields are marked *