Versions are numbered from 1 through n. Once a version is bad, every later version is also bad.
Given n and firstBad, return the first bad version. The firstBad parameter replaces LeetCode's external isBadVersion API in this exercise.
Inputn = 5, firstBad = 4
Output4
Versions 1 through 3 are good. Versions 4 and 5 are bad, so 4 is the first bad version.
Inputn = 1, firstBad = 1
Output1
Version 1 is the only version, and it is bad.
1 ≤ firstBad ≤ n ≤ 2³¹ - 1