I am trying to work with arrayList as it is asked in many codding competitions. I want to get familiarized with the arraylist as i am with normal int arrays. It requires 2 different arrayLists and then first we have add the element in one arraylist which is for row elements and another is for column elements.
List<List<Integer>> arr = new ArrayList<List<Integer>>();
List<Integer> arrCol = new ArrayList<Integer>();
Scanner scn = new Scanner(System.in);
for (int i = 0; i < arr.size(); i++) {
for(int j = 0; j < arrCol.size(); j++) {
int x = scn.nextInt();
arrCol.add(j, x);
}
arr.add(i, arrCol);
}