- 博客(4)
- 收藏
- 关注
原创 Square root
SqrtXImplement int sqrt(int x).Compute and return the square root of x.Examplesqrt(3) = 1sqrt(4) = 2sqrt(5) = 2sqrt(10) = 3ChallengeO(log(x))Solution:
2015-04-01 11:39:38 761
原创 2 sum
2 sumGiven 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 numbers such that they add up to the
2015-04-01 11:11:46 616
原创 Swap in array
Question:Given an array, detect whether can make it non-decreasing with only one swap operation in a single traverse.Example:3 1 3 4 false5 1 3 2 4 5 true5 5 2 3 4 1
2015-04-01 10:29:14 617
原创 Rotate String
Rotate StringGiven a string and an offset, rotate string by offset. (rotate from left to right)ExampleGiven "abcdefg"for offset=0, return "abcdefg"for offset=1, return "gabcdef"for
2015-04-01 00:41:35 720
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人