Junior — Senior
Determining the first defective version of the program using binary search
livecode
Task condition
There is a sorted array of software versions, in which starting from a certain position, all versions contain a bug. The function is_bad_version() takes a version number and returns true if this version is faulty. Implement a function that uses a binary search algorithm to determine the number of the first faulty version in the array.
Example function signature:
def first_bad_version(n: int) -> int:
# your code