Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Time and Space Complexity Analysis:Print Array intersection
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import java.util.*;
public class Intersection{
public static void intersection(int[] arr1, int[] arr2){
public class Solution {

public static void intersection(int[] arr1, int[] arr2){
Arrays.sort(arr1);
Arrays.sort(arr2);
merge(arr1,arr2);
Expand All @@ -11,7 +12,7 @@ public class Intersection{

while(i<arr1.length && j<arr2.length){
if(arr1[i] == arr2[j]){
System.out.println(arr1[i]);
System.out.print(arr1[i]+" ");
i++;
j++;
}else if(arr1[i] < arr2[j]){
Expand All @@ -21,4 +22,6 @@ public class Intersection{
}
}

}}
}

}