Created
March 25, 2018 22:04
-
-
Save arwankhoiruddin/9c9c7a53f87e5c978b7c2af365052c56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class MyClass | |
{ | |
public static void main (String[] args) throws java.lang.Exception | |
{ | |
int[] a = {1,2,3}; | |
int[] b = {1,3,5}; | |
LinkedList l = new LinkedList(); | |
for (int i=0; i<a.length; i++) { | |
for (int j=0; j<b.length; j++) { | |
if (a[i]==b[j]) l.add(a[i]); | |
} | |
} | |
// iterate | |
int i = 0; | |
while (i < l.size()) { | |
System.out.println(l.get(i)); | |
i++; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment