Back to problems

First Bad Version with Parallel Search Follow-up

Algorithm · Google · Medium

Requirements Versions are labeled 1..n, and the monotonic predicate isBadVersion(v) -> bool returns false for good versions and true from the first bad version onward. Return the earliest bad version while using as few predicate calls as possible. The expected warm-up is a single-threaded binary search over [1, n]. Follow-up (the graded portion): parallelize the search. Divide the version interval into buckets and inspect them concurrently—for instance, evaluate bucket…

Checking your access…