随笔分类 - 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
阅读全文
摘要: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 ...
阅读全文