FunctionRacerProblemsRace

Halfway Point

MediumNumPyPython

daily[i] is how many items were sold on day i (never negative, with a total above 0). Return the first day on which the running total reaches at least half of the grand total.

Example 1

daily [2,2,4,4]
returns 2

The grand total is 12, half is 6. The running totals are 2, 4, 8, 12, so day 2.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems