Created
May 25, 2017 12:16
-
-
Save openrijal/fe01b3c64a37b81aa66c37a408c7dd25 to your computer and use it in GitHub Desktop.
circular deaths probelm
This file contains hidden or 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
num = 100 | |
people = list(range(1,num+1)) | |
index = 0 | |
while len(people) > 1: | |
people.pop((index+1) % len(people)) | |
index = 0 if (index >= len(people)-1) else (index+1) | |
print people[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment