Files
2023-11-07 01:27:43 +02:00

22 lines
418 B
Python

from heapq import heappush, heappop
def smallest(n):
list = []
heappush(list, 1)
for x in range(n):
first_item = list[0]
heappush(list, first_item * 2)
heappush(list, first_item * 3)
heappop(list)
return list[0]
if __name__ == "__main__":
print(smallest(1)) # 2
print(smallest(5)) # 6
print(smallest(123)) # 288
print(smallest(55555)) # 663552