二分
文章平均质量分 83
iyangdi
这个作者很懒,什么都没留下…
展开
-
Google/LintCode:E-Guess Number Game
题目题目来源:LinkWe are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you wh原创 2017-08-08 20:40:26 · 242 阅读 · 0 评论 -
Google/LintCode:M-最大平均值子数组
题目题目来源:Link给出一个整数数组,有正有负。找到这样一个子数组,他的长度大于等于 k,且平均值最大。 注意事项保证数组的大小 >= k您在真实的面试中是否遇到过这个题? Yes样例给出 nums = [1, 12, -5, -6, 50, 3], k = 3返回 15.原创 2017-08-09 10:04:23 · 991 阅读 · 0 评论 -
Google/LintCode:M-寻找峰值
题目题目来源:Link你给出一个整数数组(size为n),其具有以下特点:相邻位置的数字是不同的A[0] A[n - 1]假定P是峰值的位置则满足A[P] > A[P-1]且A[P] > A[P+1],返回数组中任意一个峰值的位置。 注意事项数组可能包含多个峰值,只需找到其中的任何一个即可您在真实的面试中原创 2017-08-11 14:23:55 · 295 阅读 · 0 评论 -
Google算法题:E-二分查找
http://www.lintcode.com/zh-cn/problem/first-position-of-target/http://www.jiuzhang.com/article/Google%202016%E5%B9%B412%E6%9C%88New%20Grad%20SDE%E7%94%B5%E9%9D%A2%E9%9D%A2%E7%BB%8F/原创 2017-08-20 18:59:43 · 318 阅读 · 0 评论 -
Google算法题:M-Find the Duplicate Number
http://www.lintcode.com/zh-cn/problem/find-the-duplicate-number/http://www.jiuzhang.com/article/Google%202016%E5%B9%B412%E6%9C%88New%20Grad%20SDE%E7%94%B5%E9%9D%A2%E9%9D%A2%E7%BB%8F/原创 2017-08-20 19:26:15 · 290 阅读 · 0 评论 -
Google/LintCode:H-Median of two Sorted Array
题目LintCode:LinkThere are two sorted arrays A and B of size m and nrespectively. Find the median of the two sorted arrays.Have you met this question in a real interview? Y原创 2017-08-24 21:01:41 · 262 阅读 · 0 评论 -
LintCode:M-x的n次幂
LintCode链接实现 pow(x,n) 注意事项不用担心精度,当答案和标准输出差绝对值小于1e-3时都算正确您在真实的面试中是否遇到过这个题? Yes样例Pow(2.1, 3) = 9.261Pow(0, 1) = 0Pow(1, 0) = 1public class Sol原创 2017-08-28 10:38:37 · 333 阅读 · 0 评论 -
LintCode:M-搜索旋转排序数组
LintCode链接假设有一个排序的按未知的旋转轴旋转的数组(比如,0 1 2 4 5 6 7 可能成为4 5 6 7 0 1 2)。给定一个目标值进行搜索,如果在数组中找到目标值返回数组中的索引位置,否则返回-1。你可以假设数组中不存在重复的元素。您在真实的面试中是否遇到过这个题? Yes样例给出[4, 5, 1, 2, 3原创 2017-08-28 11:54:49 · 166 阅读 · 0 评论 -
LintCode:M-两个整数相除
LintCode链接将两个整数相除,要求不使用乘法、除法和 mod 运算符。如果溢出,返回 2147483647 。您在真实的面试中是否遇到过这个题? Yes样例给定被除数 = 100 ,除数 = 9,返回 11。标签 二分法public class Solution { /*原创 2017-08-31 16:25:59 · 308 阅读 · 0 评论