1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12953
2. 풀이
from functools import reduce
# 최대공약수
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
# 최소공배수
def lcm(a, b):
return a * b / gcd(a, b)
def solution(arr):
return reduce(lambda a,b: lcm(a,b) , arr)