
面试
xdzcz
喜欢编程的女孩~
展开
-
Merge Sort
public void mergeSort(int[] nums){ if (nums == null || nums.length == 0) return; int[] temp = new int[nums.length]; //用一个temp数组来保存sort过后的数组 sort(nums, 0, nums.length - 1, temp); } private void sort原创 2018-01-19 02:05:37 · 202 阅读 · 0 评论 -
fibonacci
public int fibonacci(int n) { if (n < 0) return -1; //报错 if (n <= 1) return 1; //第0和第1位都是'1' int pre1 = 1, pre2 = 1, cur = 2; for (int i = 2; i <= n; i++) { cur = pre1 + pre2; p原创 2018-01-19 02:49:09 · 907 阅读 · 0 评论