function checkSubset(array1, array2) {
const set1 = new Set(array1);
const set2 = new Set(array2);
for (const element of set2) {
if (!set1.has(element)) {
return false;
}
}
return true;
}
Can we consider this function's complexity to be O(n)
? The size of the arrays influences it.