From 01d5814557dbe674886def8ceef86208c8994bbc Mon Sep 17 00:00:00 2001 From: Ritik2604 <49342895+Ritik2604@users.noreply.github.com> Date: Sat, 23 May 2020 05:57:55 +0530 Subject: [PATCH] Create Intersection --- DataStructures/HashMap/Hashing/Intersection | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 DataStructures/HashMap/Hashing/Intersection diff --git a/DataStructures/HashMap/Hashing/Intersection b/DataStructures/HashMap/Hashing/Intersection new file mode 100644 index 000000000..cfe1f74d7 --- /dev/null +++ b/DataStructures/HashMap/Hashing/Intersection @@ -0,0 +1,37 @@ +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Scanner; +import java.util.Set; + +public class Intersection { + + public static ArrayList Main(int arr[],int arr2[]) { + HashMap hmap=new HashMap<>(); + HashMap hmap2=new HashMap<>(); + for(int i=0;i res=new ArrayList<>(); + for(int i=0;i0) { + int val=hmap.get(arr2[i]); + hmap.put(arr2[i],val-1); + res.add(arr2[i]); + } + + } + return res; + } + public Intersection() { + + } + + + +}