26 August 2026
Goal Day
Medium
Numbers
Find the first day when a running page total reaches a reading goal.
You are given daily page counts in order and a reading goal. Start at day 1 and keep a running total of the pages read. Return the day number when the running total first reaches or passes the goal. Return -1 if the goal is never reached.
Constraints
pages contains non-negative whole numbersDay numbers start at 1
Function signature
def goal_day(pages, goal):