โ† Visa questions

Compute nPr and nCr modulo p using Fermat's Little Theorem

Filed under Visa

Given integers n, r, and a prime number p, compute nPr % p and nCr % p. Use factorial precomputation and Fermat's Little Theorem to find modular inverses for division.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Visa questions

Collected from public candidate posts and coding forums. Updated Nov 2026.