MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / isSubset

Method isSubset

ArraySubset.java:2–16  ·  view source on GitHub ↗
( long a1[], long a2[], long n, long m)

Source from the content-addressed store, hash-verified

1class Compute {
2 public String isSubset( long a1[], long a2[], long n, long m) {
3
4 HashSet<Long> set = new HashSet<Long>();
5
6 for(int i=0;i<n;i++)
7 {
8 set.add(a1[i]);
9 }
10
11 for(int j=0;j<m;j++)
12 {
13 if(!set.contains(a2[j])) return "No";
14 }
15 return "Yes";
16 }
17}

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected