Skip to content
Back to libraryPart 2 · Core techniques

2.3Binary search

Before you start

It helps to have read 1.5 Sorting and 1.2 Complexity and limits. Overall level: Core.

Practice: Binary search

0 of 4 solved

About these problems

Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.

  1. 1First qualifying positionFor each x, find the first position in a nondecreasing array whose value is at least x. Positions are 1-based; print 0 if none exists.ApplyNot started
  2. 2Copies of a readingFor each x, report how many times it appears in a nondecreasing array.ConnectNot started
  3. 3Production deadlineThere are n machines. Machine i produces one item every t_i time units, starting with zero items at time 0; machines work in parallel. Find the earliest integer time at which at least k items have been produced.ReasonNot started
  4. 4Contiguous load limitSplit a positive array into at most k nonempty consecutive groups. Minimize the largest group sum. Every element must belong to exactly one group.StretchNot started

Read the lesson