First Bad Version
You are a product manager and currently leading a team to develop a new product. Since each version is developed based on the previous version, all the versions after a bad version are also bad. Find the first bad version.

30:00

First Bad Version
easy
Topics
Companies

You are a product manager and currently leading a team to develop a new product. Since each version is developed based on the previous version, all the versions after a bad version are also bad. Find the first bad version.

Example 1:
Input: {"n":10,"badVersion":4}
Output: 4
Constraints:
  • 1badn23111 \leq \text{bad} \leq n \leq 2^{31} - 1

Input
arr ={"n":10,"badVersion":4}

Find first bad version among 10 versions

Left
1
Mid
-
Right
10
Versions 1 to 10
1

L

2
3
4
5
6
7
8
9
10

R

Good Version
Bad Version
Current Mid
Found
Variables
No variables to display
DepthFunction Call
Stack empty
0/7