921. Factorial of a Given Number
Given an integer n, return the factorial of n.
Factorial of a non-negative integer, is the multiplication of all integers smaller than or equal to n (use 64-bits to return answer).
Example 1:
Input : n = 3
Output : 6
Explanation : Factorial = 1 * 2 * 3 => 6
Example 2:
Input : n = 5
Output : 120
Explanation : Factorial = 1 * 2 * 3 * 4 * 5 => 120
Now Your Turn!
Pick the correct output for the given inputInput : n = 4
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 0 <= n <= 15