Halfway Point
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
1 <= len(daily) <= 100- Values are whole numbers, 0 or more, with a total above 0
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Highest Cell PositionMedium
- Matching PairsMedium
- Mean of Each GroupMedium
- Multiplication TableMedium
- Order by ScoreMedium
- Pairs Hitting TargetMedium
- Pairwise SumsMedium
- Path LengthMedium