Recent posts:
--
Day 5: Question 1 & Question 2 are from Advent of code:
https://adventofcode.com/2018/day/1/answer
My answers are in the comments.
Recent posts:
--
Day 5: Question 1 & Question 2 are from Advent of code:
https://adventofcode.com/2018/day/1/answer
My answers are in the comments.
For further actions, you may consider blocking this person and/or reporting abuse
Leandro Torres -
McWilliams Bondesen -
Rafael Câmara -
Peters Roberson -
Top comments (1)
Logic for part 2:
Storing the summed frequencies as a hash as hash key lookup is faster than instead of doing an array.include? each time to check if sum already repeated.
Have to benchmark and test if this is true.
Time is O[n] as has to go thru each line in file multiple times.
Space is O[m] - m is sums.