Skip to content

Commit 2df51be

Browse files
committed
Large Factorial
1 parent 3e37d2a commit 2df51be

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""
2+
Problem Link: https://www.interviewbit.com/problems/large-factorial/
3+
4+
Problem Description
5+
Given a number A. Find the fatorial of the number.
6+
7+
Problem Constraints
8+
1 <= A <= 100
9+
10+
Input Format
11+
First and only argument is the integer A.
12+
13+
Output Format
14+
Return a string, the factorial of A.
15+
16+
17+
Example Input
18+
Input 1:
19+
A = 2
20+
21+
Input 2:
22+
A = 3
23+
24+
Example Output
25+
Output 1:
26+
2
27+
28+
Output 2:
29+
6
30+
31+
Example Explanation
32+
Explanation 1:
33+
2! = 2 .
34+
35+
Explanation 2:
36+
3! = 6 .
37+
"""
38+
class Solution:
39+
# @param A : integer
40+
# @return a strings
41+
def solve(self, A):
42+
res = 1
43+
for num in range(2, A+1):
44+
res *= num
45+
return str(res)

0 commit comments

Comments
 (0)