Created
March 4, 2014 07:53
-
-
Save tangentstorm/9342041 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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