The versions form a pattern: [good, good, good, bad, bad, bad]. You need to find the first bad. This is exactly lower bound: find the first position where a condition becomes true.
Set left = 1, right = n.
While left < right, compute mid = left + (right - left) / 2.
If isBadVersion(mid) is true, the first bad is at mid or earlier. Set right = mid.
Otherwise, set left = mid + 1.
Return left.