Leetcode P0278”First Bad Version” 题解

1 · Qiaoyi Yin · July 30, 2021, 4 p.m.
博文中会简要介绍Leetcode P0278题目分析及解题思路。 “First Bad Version”是比较简单的题目,利用二分搜索找到临界点即可。临界点特征是:比它更小的版本是鲁棒的,比它更大的版本是有漏洞的。这样的特征其实可以找到两个临界点,靠右的临界点是最早的出现漏洞的版本。 You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad. Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one,...