[Programmers] 줄 서는 방법
Python
import math
def solution(n, k):
answer = []
temps = list(range(1, n + 1))
k -= 1
for i in range(n, 0, -1):
div, k = divmod(k, math.factorial(i - 1))
answer.append(temps.pop(div))
return answer
댓글남기기