I put numbers of three people in one arraylist and in the case if three people have the same number then overall occurrences++
; this is my algorithm but it is not working for this case!!
5 (first person has 5 nums)
13 20 22 43 1464 (second person has 4 nums)
13 22 43 1465 (third person has 5 nums)
13 43 67 89 146
int occurrences = 0;
for (int i = 0; i<n; ++i){
for (int j = n; j<n+b; ++j ){
if(arr.get(i)==arr.get(j)){
System.out.println(arr.get(i)+" " +arr.get(j));
for(int k=n+b; k<arr.size(); ++k){
if(arr.get(j)==arr.get(k)){
++occurrences;
System.out.println(arr.get(k));
}
}
}
}
}