First Bad Version
Try to solve the First Bad Version problem.
We'll cover the following
Statement
The latest version of a software product fails the quality check. Since each version is developed upon the previous one, all the versions created after a bad version are also considered bad.
Suppose you have n
versions with the IDs , and you have access to an API function that returns TRUE if the argument is the ID of a bad version.
Find the first bad version that is causing all the later ones to be bad. Additionally, the solution should also return the number of API calls made during the process and should minimize the number of API calls too.
Constraints:
- first bad version
n
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy