Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##############
- ### DAY 04 ###
- ##############
- ### part 1
- using ProgressMeter
- pb = ProgressMeter.Progress(595730-136760, dt=1, barglyphs=BarGlyphs("[=> ]"), barlen=50, color=:yellow)
- passwords = []
- for i in 136760:595730
- # i = 136760
- # println(i)
- i_split = parse.(Int64, convert(Array{String,1}, split(string(i), "")))
- i_test1 = i_split[1:(end-1)] .<= i_split[2:end]
- i_test2 = i_split[1:(end-1)] .== i_split[2:end]
- if (sum(i_test1) == length(i_test1)) & (sum(i_test2) > 0)
- push!(passwords, i)
- end
- ProgressMeter.update!(pb, i-136760)
- end
- solution_d4p1 = length(passwords)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement