This post originally appeared on Arjun Rajkumar's blog. Arjun runs web development company based in Bangalore, India.
--
Day 5: Question 1 &...
For further actions, you may consider blocking this person and/or reporting abuse
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.