Given an unsorted integer array, find the first
missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1]
return 2.Your algorithm sho...
分类:
其他好文 时间:
2014-05-16 02:58:54
阅读次数:
249
非常考虑思维全面性的一道题,考验是否能够考虑本问题的方方面面。题目:将一个string转换为int。实现函数atoi()的功能。先应该明确atoi()有哪些特殊功能:(正常的正负数情况我就不列了)inputoutput”+1“1”
+ 1“0(error了)” 1“1(前头只有空格是合法的...
分类:
其他好文 时间:
2014-05-16 01:08:33
阅读次数:
245
经历了三道树的题后,完全崩溃中,急需一道非树图的题来挽救信心。题目:反转数字。input : 123
, output : 321.思路:直接,没什么好说的。自己代码:很龊,有大量的冗余信息,还申请了一个List,虽然AC了,但有很大改进空间。public
int reverse(int x) { ...
分类:
其他好文 时间:
2014-05-15 14:22:31
阅读次数:
212
public class Test { public static void
main(String[] string){ int i = Integer.MAX_VALUE; System.out.println(i); ...
分类:
其他好文 时间:
2014-05-15 10:13:33
阅读次数:
224
String s="32"; int i=Integer.parseInt(s);
System.out.println(i);这样没有问题 String s="3g"; int i=Integer.parseInt(s); Sy...
分类:
其他好文 时间:
2014-05-15 09:23:50
阅读次数:
234
当客户端请求速度远远大于服务端的处理速度,这时候就非常适合使用GuardedSuspention模式packagecn.fcl.guardendSuspension;
importjava.util.ArrayList;
importjava.util.List;
publicclassRequestQueue{
privateList<Integer>integers=newArrayList<Integer>();
..
分类:
编程语言 时间:
2014-05-15 09:08:21
阅读次数:
283
【题目】
A sequence of N positive integers (10 N , each of them less than or equal 10000, and a positive integer S (S <
100 000 000) are given. Write a program to find the minimal length of the subse...
分类:
其他好文 时间:
2014-05-15 07:58:17
阅读次数:
329
join()Array.join(/*optional*/separator)将数组转换为字符串,可带一个参数separator(分隔符,默认为“,”)。与之相反的一个方法是:String.splict(),将字符串分隔成若干块来创建一个新的数组。reverse()Array.reverse(),颠倒数组元素的顺序,返回逆向的数组.注意此方法会修..
分类:
编程语言 时间:
2014-05-15 00:31:23
阅读次数:
441
1.注意规则
2.注意最小的负数的绝对值比最大的正数的绝对值大1,所以 line 13: (str[i] - '0') > INT_MAX%10不能取等号...
分类:
其他好文 时间:
2014-05-14 23:52:26
阅读次数:
478