
面试题
Francis-Yu
这个作者很懒,什么都没留下…
展开
-
恒生电子的坑爹Java笔试题
public class TestCodeSeg {static {System.out.println("1");}{System.out.println("2");}public TestCodeSeg() {System.err.println("3");}public static void main(String[] args) {原创 2013-04-14 21:36:40 · 5713 阅读 · 0 评论 -
给定一个数组,数组中有正负数,求出所有字数组中和值最大的值。
/**当我们加上一个正数时,和会增加;当我们加上一个负数时,和会减少。如果当前得到的和是个负数,那么这个和在接下来的累加中应该抛弃并重新清零, 不然的话这个负数将会减少接下来的和*/ public static int maxSum(int[] a) { int sum = 0; //指定的和 int b = 0; //控制 for (int i = 0; i < a.l原创 2013-09-20 15:13:10 · 2031 阅读 · 0 评论 -
运用递归给定一个int型的整数,倒序输出他的每一位上的数字
运用递归给定一个int型的整数,倒序输出他的每一位上的数字 eg:54321 则输出12345public static void printOut(int n) { System.out.print(n % 10); if (n >= 10) { printOut(n / 10); } }时间复杂度是O(n)原创 2013-09-20 15:02:52 · 2076 阅读 · 0 评论