-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp1_14.java
More file actions
26 lines (24 loc) · 714 Bytes
/
p1_14.java
File metadata and controls
26 lines (24 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class p1_14 {
public static ArrayList<Integer> repeatedRows(int matrix[][], int m, int n)
{
//code here
ArrayList<Integer> arr = new ArrayList<Integer>();
for(int i=m-1; i>=0;i--){
for(int j=0; j<i; j++){
if(Arrays.compare(matrix[i], matrix[j]) == 0){
arr.add(i);
break;
}
}
}
Collections.sort(arr);
return arr;
}
public static void main(String[] args) {
int matrix[][] = {{1, 0}, {1, 0}};
System.out.println(repeatedRows(matrix, 2, 2));
}
}