Algorithms

Factorial

Multiplying a number by every smaller one down to 1. It's written n! and counts how many ways n things can be ordered.

Example

4! = 4 × 3 × 2 × 1 = 24: there are 24 ways to order 4 books on a shelf. With 10 books it's 3,628,800.

Test yourself: Factorial

Time complexity

With 3 elements A, B and C there are ___ possible orders.

Lessons that use it

More algorithms terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.