Re:Show HN: Learn to Code for Free
by pythonaut_16 on Wednesday November 23, 2016 @01:24PM
(#13024578)
I would probably keep a running total as I read through each line, then store `line_number: running_total` in a dictionary.
At the end, return the highest key in the dictionary for your total, and then run a reduce that returns the first key/value pair that is >= half the total
At the end, return the highest key in the dictionary for your total, and then run a reduce that returns the first key/value pair that is >= half the total