Size the Arrangement Space

Basic

A scheduling estimate needs the number of ways to order n distinct tasks — that is, n factorial. Compute it for small n.

Implement `solve(Integer n)` (0 ≤ n ≤ 12) to return n! (the product 1×2×…×n; 0! is 1).

Examples

Inputn = 5
Output120
Inputn = 0
Output1
Hints
  • Multiply a running product from 1 up to n; start the product at 1 so 0! is 1.
Anonymous Apex

Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.