You are viewing a single comment's thread. Return to all comments →
Scala
def pageCount(n: Int, p: Int): Int = { //Sample book: 1 - 2 3 - 4 5 - 6 7 - 8 9 - 10 11 val lastPage = if(n % 2 == 0) n+1 else n val firstPage = 0 val fromFirst: Int = p/2 val fromLast: Int = (lastPage - p)/2 Array(fromFirst, fromLast).min }
Seems like cookies are disabled on this browser, please enable them to open this website
Drawing Book
You are viewing a single comment's thread. Return to all comments →
Scala