摘要:
Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the l 阅读全文
摘要:
Implement int sqrt(int x). Compute and return the square root of x. sqrt(3) = 1 sqrt(4) = 2 sqrt(5) = 2 sqrt(10) = 3 mid*mid 以及 (mid + 1) * (mid + 1)都 阅读全文
摘要:
Write a method to replace all spaces in a string with%20. The string is given in a characters array, you can assume it has enough space for replacemen 阅读全文
摘要:
Singleton is a most widely used design pattern. If a class has and only has one instance at every moment, we call this design as singleton. For exampl 阅读全文
摘要:
Given 2*n + 1 numbers, every numbers occurs twice except one, find it. Given [1,2,2,1,3,4,3], return 4 因为所有数都出现了两次,只有一个出现一次,所以只要把所有数做XOR,就可以得到出现一次的数 p 阅读全文
摘要:
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
摘要:
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or 阅读全文
摘要:
Given a string and an offset, rotate string by offset. (rotate from left to right) Given "abcdefg". offset=0 => "abcdefg" offset=1 => "gabcdef" offset 阅读全文
摘要:
Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". Clarification What constitut 阅读全文