Solution: First Bad Version
Explore how to apply a modified binary search to identify the first bad software version in a sorted sequence, minimizing calls to the version-check API. This lesson guides you through the step-by-step implementation, highlights the time and space complexity advantages, and helps you master this common interview problem pattern.
Statement
You are managing a product development team, and the latest release has failed quality checks. Because each version is built on top of the previous one, once a version is bad, every version after it is also bad.
You are given an array of n versions
You have access to an API IsBadVersion(version) that returns TRUE if a given version is bad.
Your task is to find the first bad version while minimizing the number of calls to this API.
Constraints:
bad...