modInverse function

int modInverse(
  1. int a,
  2. int mod
)

Modular inverse using Fermat's little theorem.

Implementation

int modInverse(int a, int mod) {
  return modExp(a, mod - 2, mod);
}