You are viewing a single comment's thread. Return to all comments →
Easy python
def absolutePermutation(n, k): if k == 0: return list(range(1,n+1)) if (n/k)%2 != 0: return [-1] res = [] up = True for i in range(n//k): for j in range(k): res.append(i*k+1+j + (k if up else -k)) up = not up return res
Seems like cookies are disabled on this browser, please enable them to open this website
Absolute Permutation
You are viewing a single comment's thread. Return to all comments →
Easy python