一、数组和容器
1、数组的元素为List:
// 构建一个长度为s.length() + 1的数组frequencyBucket,元素为List<Character>
List<Character>[] frequencyBucket = new ArrayList[s.length() + 1];
2、List的元素为数组:
int[][] people = {{7, 0}, {4, 4}, {7, 1}, {5, 0}, {6, 1}, {5, 2}};
// 构建一个列表output,其元素为int[]
List<int[]> output = new LinkedList<>();
for(int[] p : people){
output.add(p[1], p); // add方法会在指定的index上插入值,如果index上已有值,则将新值插入当前值之前
}
int n = people.length;
int[][] = output.toArray(new int[n][2]);
二、(待续)