摘要: LeetCode 374. Guess Number Higher or Lower(猜数字大小) 题目 链接 https://leetcode-cn.com/problems/guess-number-higher-or-lower 问题描述 猜数字游戏的规则如下: 每轮游戏,我都会从 1 到 n 阅读全文
posted @ 2020-02-03 20:20 cheng102e 阅读(115) 评论(0) 推荐(0)
摘要: LeetCode 278. First Bad Version(第一个错误的版本) 题目 链接 https://leetcode-cn.com/problems/first-bad-version 问题描述 你是产品经理,目前正在带领一个团队开发新的产品。不幸的是,你的产品的最新版本没有通过质量检测 阅读全文
posted @ 2020-02-03 20:12 cheng102e 阅读(108) 评论(0) 推荐(0)
摘要: LeetCode 35. Search Insert Position (搜索插入位置) 题目 链接 https://leetcode-cn.com/problems/search-insert-position/ 问题描述 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值 阅读全文
posted @ 2020-02-03 13:46 cheng102e 阅读(125) 评论(0) 推荐(0)
摘要: 查找算法 二分查找 标题 二分查找也称折半查找(Binary Search),它是一种效率较高的查找方法。但是,折半查找要求线性表必须采用顺序存储结构,而且表中元素按关键字有序排列。 过程 首先,假设表中元素是按升序排列,将表中间位置记录的关键字与查找关键字比较,如果两者相等,则查找成功;否则利用中 阅读全文
posted @ 2020-02-03 13:08 cheng102e 阅读(204) 评论(0) 推荐(0)