4 ms·
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
by pythonaut_16 10y ago
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