We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 03cd2e6 + e2fd78e commit 1330547Copy full SHA for 1330547
python/0278-first-bad-version.py
@@ -0,0 +1,10 @@
1
+class Solution:
2
+ def firstBadVersion(self, n: int) -> int:
3
+ l, r = 1, n
4
+ while l < r:
5
+ v = (l + r) // 2
6
+ if isBadVersion(v):
7
+ r = v
8
+ else:
9
+ l = v + 1
10
+ return l
0 commit comments