Given a positive integer, n. Find the factorial of n.
Example 1
Input: n = 5
Output: 120
Explanation: 1 x 2 x 3 x 4 x 5 = 120
Example 2
Input: n = 10
Output: 3628800
Explanation: 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1
Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.