DS Algo Problems
This blog contain solutions of Data Structure & Algorithm problems.
Pages - Menu
Home
Arrays
Linked List
Stacks
Strings
Trees
Dynamic Programming
Graphs
Hackerrank
Tuesday, 8 November 2016
Hackerrank , Project Euler #5: Smallest multiple
Project Euler #5: Smallest multiple
from fractions import gcd
def lcm(numbers):
return reduce(lambda x, y: (x*y)/gcd(x,y), numbers)
t=input()
for i in range(0,t):
print lcm(range(1,input()+1))
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment