Type hints for improving performance
This commit is contained in:
parent
c3a4e0a627
commit
f5152ece96
@ -16,7 +16,7 @@ function chain_length(n, terms)
|
||||
break
|
||||
end
|
||||
if n % 2 == 0
|
||||
n = n / 2
|
||||
n = n ÷ 2
|
||||
else
|
||||
n = 3n + 1
|
||||
end
|
||||
@ -50,7 +50,8 @@ function Problem14()
|
||||
ans = 0
|
||||
limit = 1_000_000
|
||||
score = 0
|
||||
terms = Dict()
|
||||
terms = Dict{Int, Int}()
|
||||
sizehint!(terms, limit)
|
||||
for i in 1:limit
|
||||
terms[i] = chain_length(i, terms)
|
||||
if terms[i] > score
|
||||
|
Loading…
x
Reference in New Issue
Block a user