Problem
Submissions

Problem: First Bad Version

Statement

The latest version of a software product has failed the quality check. Because each version builds on the previous one, all versions developed after a bad version are also considered bad. You are given n versions identified by integers [1,2,3,…,n][1, 2,3, \dots, n], and an API function is_bad_version(version) that returns TRUE if a given version is bad.

Your task is to find the first bad version that causes all subsequent versions to fail while minimizing the number of API calls.

Constraints:

  • 1≤1 \leq first bad version ≤\leq n

Problem
Submissions

Problem: First Bad Version

Statement

The latest version of a software product has failed the quality check. Because each version builds on the previous one, all versions developed after a bad version are also considered bad. You are given n versions identified by integers [1,2,3,…,n][1, 2,3, \dots, n], and an API function is_bad_version(version) that returns TRUE if a given version is bad.

Your task is to find the first bad version that causes all subsequent versions to fail while minimizing the number of API calls.

Constraints:

  • 1≤1 \leq first bad version ≤\leq n