• + 0 comments

    TS SOLUTION:

    function pageCount(n: number, p: number): number { // Write your code here const leftFlips: number = Math.floor(p / 2) const rightFlips: number = Math.ceil(((n - n % 2) - p) / 2) return Math.min(leftFlips, rightFlips) }