Chinaunix首页 | 论坛 | 博客
  • 博客访问: 119662
  • 博文数量: 53
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 620
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-24 16:22
文章存档

2014年(53)

我的朋友

发布时间:2014-10-07 14:29:36

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:.........【阅读全文】

阅读(798) | 评论(0) | 转发(0)

发布时间:2014-10-07 14:23:17

Divide two integers without using multiplication, division and mod operator.整数的除法,但无法用乘号,除号和余号。可以考虑二分,假设A/B, 则解空间在[0, A]当B*A/2<A时,表明解在[A/2,A]之间==>注意这里A/2可能是解,因为整数的除法是舍去余数的当B*A/2>A时,表明解在[0, A/2)之间,当B*A/2==A时,表明解.........【阅读全文】

阅读(854) | 评论(0) | 转发(0)

发布时间:2014-10-07 14:07:10

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest product = 6.求一串数字的最大子串积。这不禁让人想到了最大子串和的那个问题,不.........【阅读全文】

阅读(1009) | 评论(0) | 转发(0)

发布时间:2014-10-02 22:13:11

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).就是两个有序数组,求它们组合成的有序数组的中位数。当然,可以根据我的另一篇博文“两个等长有序数组的中位数”介绍的原理来求,但是。。。.........【阅读全文】

阅读(1011) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册