Skip to content

Commit

Permalink
Refactored collatz_eval to get rid of list. This implementation still…
Browse files Browse the repository at this point in the history
… gets wrong answer (WA) on Sphere
  • Loading branch information
Mark committed Jun 15, 2014
1 parent 47915d8 commit 3c282b2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions SphereCollatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ def collatz_eval (i, j) :
"""
# <your code>
c_len=0
end=j+1
result=0
for num in range(i,end):
result=cycle_length(num)
if c_len < result:
k=max(i,j)
i=min(i,j)

while( k >= i):
result=cycle_length(k)
if (c_len < result) :
c_len=result
k-=1

return c_len

Expand Down

0 comments on commit 3c282b2

Please sign in to comment.