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.
- 1First qualifying positionYou are given a list of n integers a1 ≤ a2 ≤ ... ≤ an in nondecreasing order, with positions numbered from 1. Answer q queries. For each query value x, print the first position i with ai ≥ x, or 0 if no such position exists.ApplyNot started
- 2Copies of a readingYou are given a list of n integers a1 ≤ a2 ≤ ... ≤ an in nondecreasing order. Answer q queries. For each query value x, print how many times x appears in the list.ConnectNot started
- 3Production deadlineThere are n machines working in parallel, starting at time 0 with zero items. Machine i finishes one item every ti time units, so its items are completed at times ti, 2×ti, 3×ti, and so on. Find the earliest integer time at which at least k items have been produced in total.ReasonNot started
- 4Contiguous load limitYou are given a list of n positive integers a1, a2, ..., an. Split the list into at most k nonempty groups of consecutive elements, so that every element belongs to exactly one group. Find the smallest possible value of the largest group sum.StretchNot started