728x90
SMALL
from math import gcd
def solution(arr):
def lcm(x,y):
return x*y // gcd(x,y)
while True:
arr.append(lcm(arr.pop(),arr.pop()))
if len(arr)==1:
return arr[0]
728x90
LIST
'취준시절 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 피보나치 수 - Python (0) | 2021.08.05 |
---|---|
[프로그래머스] JadenCase 문자열 만들기 - Python (0) | 2021.08.04 |
[프로그래머스] 같은 숫자는 싫어 - Python (0) | 2021.07.09 |
[프로그래머스] 가운데 글자 가져오기 - Python (0) | 2021.07.09 |
[프로그래머스] x만큼 간격이 있는 n개의 숫자 - Python (0) | 2021.07.09 |