Skip to content

Commit

Permalink
Circular counter algorithm optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed Nov 2, 2017
1 parent 93eab61 commit fb2702a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions array/circular_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
def josepheus(int_list, skip):
skip = skip - 1 #list starts with 0 index
idx = 0
len_list(len(int_list))
len_list = (len(int_list))
while len_list>0:
idx = (skip+idx)%len(int_list) #hashing to keep changing the index to every 3rd
idx = (skip+idx)%len_list #hashing to keep changing the index to every 3rd
print(int_list.pop(idx))
len_list -= 1

Expand Down

0 comments on commit fb2702a

Please sign in to comment.