You are viewing a single comment's thread. Return to all comments →
python
def absolutePermutation(n, k): if k == 0: return list(range(1, n + 1)) elif (n / k) % 2 == 0: res = [] for i in range(1, n + 1): if (i - 1) // k % 2 == 0: res.append(i + k) else: res.append(i - k) return res else: return [-1]
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 →
python