Problems

Factorial

easy
easy
math
recursion

Given a non-negative integer n, return n! (n factorial), the product of all positive integers less than or equal to n. By definition 0! = 1.

Examples

Example 1

Input: n = 0
Output: 1

Example 2

Input: n = 5
Output: 120

Example 3

Input: n = 7
Output: 5040

Running will execute all 3 cases.