Skip to content
StackDecode
Number theory & mathExplained

Modular Arithmetic

Arithmetic that wraps around a modulus.

Time

O(1) per op

Extra space

O(1)

Use it for

Hashing, cryptography, big results.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.