I am very happy because I solved this problem with very little code:
"""
100 people are standing in a circle with gun in their hands.
1 kills 2, 3 kills 4, 5 kills 6 and so on till we are
left with only one person. Who will be the last person alive?
Write code to implement this ##efficiently.## <-[ Python is not efficient]
"""
persons = list(range(1,101)) # The question asks 1-indexing
while len(persons) > 1:
for index, person in enumerate(persons):
del persons[(index + 1) % len(persons)]
print(persons)
@dotancohen here at CodeReview we review different implementations of the same algorithm, also that question is in Java, a different language.