Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# this is just the third step
input = [ 2, 8, 3, 5 ] # an array of unique items
n = len(input)
# (...)
order = [ 3, 0, 2, 1 ] # first two steps created this
output = [ 0 ] * n
for i in range(n):
output[order[i]] = input[i]
assert output == [8, 5, 3, 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.