Skip to content

Instantly share code, notes, and snippets.

@arwankhoiruddin
Created March 25, 2018 22:04
Show Gist options
  • Save arwankhoiruddin/9c9c7a53f87e5c978b7c2af365052c56 to your computer and use it in GitHub Desktop.
Save arwankhoiruddin/9c9c7a53f87e5c978b7c2af365052c56 to your computer and use it in GitHub Desktop.
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