Factorial
EasyAcceptance: N/A
Given a non-negative integer n, return the factorial of n.
The factorial of n is the product of all positive integers less than or equal to n. By definition, 0! = 1.
Example 1:
Input: n = 5
Output: 120
Explanation: 5! = 5 × 4 × 3 × 2 × 1 = 120
Example 2:
Input: n = 0
Output: 1
Explanation: 0! = 1 by definition
Constraints:
- 0 <= n <= 12
Discussion
Please login to view and join the discussion.
Login to ContinueLoading...
Status:Not run yet
Run your code to see results