-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecrease_Complexity.java
More file actions
50 lines (48 loc) · 896 Bytes
/
Decrease_Complexity.java
File metadata and controls
50 lines (48 loc) · 896 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package practicetime;
import java.util.Scanner;
public class Decrease_Complexity
{
public static void main(String args[])
{
int i,i1=0,s=1;
Scanner sc=new Scanner(System.in);
System.out.println(" Enter The Value Of N - ");
int n=sc.nextInt();
int a[]=new int[n];
System.out.println(" Enter The Values - ");
for(i=0;i<n;i++)
{
a[i]=sc.nextInt();
}
System.out.println(" Enter The Value Of N1 - ");
int n1=sc.nextInt();
int b[]=new int[n1];
System.out.println(" Enter The Values - ");
for(i=0;i<n1;i++)
{
b[i]=sc.nextInt();
}
int c;
c=b[i1];
for(i=0;i<n;i++)
{
if(a[i]==c)
{
System.out.println(" Duplicate - "+a[i]);
s=2;
}
if(i==(n-1))
{
i1=i1+1;
if(i1<n1)
{
i=-1;
c=b[i1];
}
}
}
if(s==1){
System.out.println("No Duplicate");
}
}
}