Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up

Factorial of N

Easy Acceptance 60.00% Points 20.00

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

Hints
Hint 1
N/A
Constraints
  • 0 = n = 12
Companies
Microsoft Visa Arcesium
Topics
Recursion
Solution.cs C#JavaPythonC++Javascript

Unlock the code editor

Sign in to write, run, and submit your solution against the full test suite.

  • Run code against sample & hidden test cases
  • Save submissions and track your streak
  • Compare with editorial & community solutions