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.
Example 1: Input: n = 5 Output: 120
Example 2: Input: n = 0 Output: 1
Constraints: 0 <= n <= 12
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.
Example 1: Input: n = 5 Output: 120
Example 2: Input: n = 0 Output: 1
Constraints: 0 <= n <= 12
Copyright 2026 algowars. All rights reserved.
Input 1 (integer)
0
Output 1 (integer)
1