MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / factorial

Method factorial

60. Permutation Sequence/src/main.rs:23–28  ·  view source on GitHub ↗

used for small num a: a!

(n: usize)

Source from the content-addressed store, hash-verified

21
22 /// used for small num a: a!
23 pub fn factorial(n: usize) -> usize {
24 match n {
25 0 | 1 => 1,
26 _ => n * Self::factorial(n - 1),
27 }
28 }
29}
30
31#[cfg(test)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected