www

导航

2019年3月1日 #

最小的K个数

摘要: public class Solution { public ArrayList GetLeastNumbers_Solution(int [] input, int k) { ArrayList ret = new ArrayList(); if(k > input.length) return ret; PriorityQueue mi... 阅读全文

posted @ 2019-03-01 10:43 www_practice 阅读(136) 评论(0) 推荐(0) 编辑

数组中出现次数超过一半的数字

摘要: public int MoreThanHalfNum_Solution(int [] array) { if(array==null||array.length==0) return 0; int ret=array[0]; int times=1; for(int i=1; iarray.length/2) return ret; else return... 阅读全文

posted @ 2019-03-01 10:08 www_practice 阅读(142) 评论(0) 推荐(0) 编辑

字符串的排列

摘要: import java.util.*; public class Solution { public ArrayList Permutation(String str){ ArrayList ret = new ArrayList(); if(str!=null || str.length()>0){ helper(str.toCharArray(... 阅读全文

posted @ 2019-03-01 09:36 www_practice 阅读(125) 评论(0) 推荐(0) 编辑