File size: 626 Bytes
c574d3a |
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 27 28 29 30 31 32 33 34 |
import java.io.*;
import java.util.*;
public class Nonrep{
public static void main(String[] args) {
int arr[] = {-1,-1,2,4,3};
HashMap<Integer, Integer> hm = new HashMap<>();
for(int val: arr){
if(hm.containsKey(val)){
int of = hm.get(val);
int mf = of+1;
hm.put(val,mf);
}
else{
hm.put(val,1);
}
}
for(int i: hm.keySet()){
if(hm.get(i) == 1){
System.out.println(i);
}
}
}
}
|