Skip to content
← Back to the archive

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 numbers
  • Day numbers start at 1

Function signature

def goal_day(pages, goal):

Sign in to solve this bracket

Reading the problem is free for everyone. Opening the editor and solving it requires an account with Open Bracket+.