⭐ 나의 풀이
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'extraLongFactorials' function below.
#
# The function accepts INTEGER n as parameter.
#
def extraLongFactorials(n):
# Write your code here
if n < 2 :
return 1
else :
return n * extraLongFactorials(n-1)
if __name__ == '__main__':
n = int(input().strip())
print(extraLongFactorials(n))
기본적인 재귀 호출 구현 문제
이 문제가 Medium이라니??
문제 출처 👇👇
https://www.hackerrank.com/challenges/extra-long-factorials/problem?isFullScreen=true
반응형
'coding test > HackerRank' 카테고리의 다른 글
[HackerRank] Matrix Layer Rotation (1) | 2023.05.18 |
---|---|
[HackerRank] Queen's Attack 2 (0) | 2023.05.17 |
[HackerRank] Non-Divisible Subset (0) | 2023.05.16 |
[HackerRank] Climbing the Leaderboard (0) | 2023.05.15 |
[HackerRank] Forming a Magic Square (0) | 2023.05.14 |