We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 231aec0 commit f0d703cCopy full SHA for f0d703c
Arrays/Find All Non Repeating Element in Array.java
@@ -0,0 +1,34 @@
1
+import java.util.Scanner;
2
+public class main{
3
+ public static void main(String[] args){
4
+ Scanner sc = new Scanner(System.in);
5
+
6
+ int n = sc.nextInt();
7
+ int a[] = new int[n];
8
+ for(int i=0; i<n; i++){
9
+ a[i]=sc.nextInt();
10
+ }
11
+ boolean visit[] = new boolean[n];
12
+ int temp[] = new int[n];
13
14
15
+ for(int j=i+1; j<n; j++){
16
+ if(a[i]==a[j] && !visit[j]){
17
+ temp[i]=a[i];
18
+ visit[j]=true;
19
+ break;
20
21
22
23
24
25
+ int res = a[i]-temp[i];
26
+ if(res==0){
27
+ continue;
28
29
+ else{
30
+ System.out.print(res+" ");
31
32
33
34
+}
0 commit comments