• + 0 comments

    rust in O(1) solution

    fn page_count(n: i32, p: i32) -> i32 {
        (p / 2).min((n - p + (n + 1) % 2) / 2)
    }