n
versions[1, 2, ..., n]
and you want to find out the first bad one, which causes all the following ones to be bad.bool isBadVersion(version)
which will return whetherversion
is bad. Implement a function to find the first bad version. You should minimize the number of calls to the API.