随笔分类 -  arithmetic

摘要:已经排好序了,所以我们可以借此同时对三个数组进行搜索来找到共同元素下面是java实现代码:import java.util.HashSet;import java.util.Set;public class threeListComm { /** * 3 soted array, find common elements */ static int [] a = {1,3,4,5,6,7,9}; static int [] b = {1,5,8,9,11}; static int [] c = {2,3,5,6}; static Set<Integer> s = new HashS 阅读全文
posted @ 2013-06-20 11:36 花考拉 阅读(766) 评论(0) 推荐(0) 编辑
摘要:1 import java.util.ArrayList; 2 import java.util.List; 3 import java.util.Random; 4 5 6 public class RandRange { 7 8 public List<Integer> get(int start, int end){ 9 int cnt = end - start + 1;//计算从start到end之间数字的个数。10 List<Integer> randRes = new ArrayList<Integer>();11 ... 阅读全文
posted @ 2013-04-22 22:12 花考拉 阅读(693) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示