Skip to content

Commit 8802fb5

Browse files
refactor 278
1 parent bc3f9fd commit 8802fb5

File tree

1 file changed

+10
-1
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+10
-1
lines changed

src/main/java/com/fishercoder/solutions/_278.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@
66
* You are a product manager and currently leading a team to develop a new product.
77
* Unfortunately, the latest version of your product fails the quality check.
88
* Since each version is developed based on the previous version, all the versions after a bad version are also bad.
9+
*
910
* Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one,
1011
* which causes all the following ones to be bad.
1112
*
1213
* You are given an API bool isBadVersion(version) which will return whether version is bad.
13-
* Implement a function to find the first bad version. You should minimize the number of calls to the API.*/
14+
* Implement a function to find the first bad version. You should minimize the number of calls to the API.
15+
*
16+
* Example:
17+
* Given n = 5, and version = 4 is the first bad version.
18+
* call isBadVersion(3) -> false
19+
* call isBadVersion(5) -> true
20+
* call isBadVersion(4) -> true
21+
* Then 4 is the first bad version.
22+
* */
1423
public class _278 {
1524

1625
public static class Solution1 {

0 commit comments

Comments
 (0)