Bootcamps
Masterclasses
Menu
Courses
Account
Login / Sign Up

Factorial of N

Easy Acceptance 60% Points 20

Given a positive integer, n. Find the factorial of n.

Examples
Example 1

Example 1

Input: n = 5

Output: 120

Explanation: 1 x 2 x 3 x 4 x 5 = 120

Example 2

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

Constraints
  • 0 = n = 12
Topics
Recursion
Companies
Microsoft Visa Arcesium
Added 19 Jul 2026 60% acceptance
Ln 1, Col 1Sign in to save your code
Sample inputs for this problem are shown in the examples.