mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 03:11:42 +08:00
批量更新数据
This commit is contained in:
@@ -2,32 +2,32 @@
|
||||
|
||||
<p>假设你有 <code>n</code> 个版本 <code>[1, 2, ..., n]</code>,你想找出导致之后所有版本出错的第一个错误的版本。</p>
|
||||
|
||||
<p>你可以通过调用 <code>bool isBadVersion(version)</code> 接口来判断版本号 <code>version</code> 是否在单元测试中出错。实现一个函数来查找第一个错误的版本。你应该尽量减少对调用 API 的次数。</p>
|
||||
|
||||
<p>你可以通过调用 <code>bool isBadVersion(version)</code> 接口来判断版本号 <code>version</code> 是否在单元测试中出错。实现一个函数来查找第一个错误的版本。你应该尽量减少对调用 API 的次数。</p>
|
||||
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>n = 5, bad = 4
|
||||
<strong>输出:</strong>4
|
||||
<strong>解释:</strong>
|
||||
<code>调用 isBadVersion(3) -> false
|
||||
调用 isBadVersion(5) -> true
|
||||
调用 isBadVersion(4) -> true</code>
|
||||
<code>调用 isBadVersion(3) -> false
|
||||
调用 isBadVersion(5) -> true
|
||||
调用 isBadVersion(4) -> true</code>
|
||||
<code>所以,4 是第一个错误的版本。</code>
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>n = 1, bad = 1
|
||||
<strong>输出:</strong>1
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= bad <= n <= 2<sup>31</sup> - 1</code></li>
|
||||
<li><code>1 <= bad <= n <= 2<sup>31</sup> - 1</code></li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user