摘要:
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. 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
个人理解,可能有误。理解自《java编程思想》。 首先,什么是RTTI? RTTI(run-time type information)指的是Java在运行时能够获得或判断某个对象的类型信息。以Shape, Circle, Squre, Triangle为例,后三者继承shape。 主要有三种方式: 阅读全文
摘要:
Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 要求不使用乘法、除法或模运算实现: dividend/divisor,也就是 阅读全文
摘要:
Implement pow(x, n). 阅读全文
摘要:
Implement int sqrt(int x). Compute and return the square root of x. 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文