摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
posted @ 2015-06-27 10:59 Mr.do 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a functi 阅读全文
posted @ 2015-06-25 15:38 Mr.do 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va 阅读全文
posted @ 2015-06-24 19:46 Mr.do 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 个人理解,可能有误。理解自《java编程思想》。 首先,什么是RTTI? RTTI(run-time type information)指的是Java在运行时能够获得或判断某个对象的类型信息。以Shape, Circle, Squre, Triangle为例,后三者继承shape。 主要有三种方式: 阅读全文
posted @ 2015-06-24 17:02 Mr.do 阅读(1391) 评论(0) 推荐(0) 编辑
摘要: Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 要求不使用乘法、除法或模运算实现: dividend/divisor,也就是 阅读全文
posted @ 2015-06-22 14:43 Mr.do 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n). 阅读全文
posted @ 2015-06-21 14:52 Mr.do 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x). Compute and return the square root of x. 阅读全文
posted @ 2015-06-21 11:35 Mr.do 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2015-06-18 18:39 Mr.do 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
posted @ 2015-06-17 16:29 Mr.do 阅读(99) 评论(0) 推荐(0) 编辑
摘要: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to 阅读全文
posted @ 2015-06-16 15:12 Mr.do 阅读(80) 评论(0) 推荐(0) 编辑