function pageCount(n, p) {
/*
* Write your code here.
*/
const isFromLast = (n - p) <= (p-1);
if (isFromLast) {
if (n % 2 === 0) {
return Math.ceil((n - p) / 2)
}
return Math.floor((n - p) / 2)
} else {
return Math.floor(p/2);
}
}
pageCount(7, 4);
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)