• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
August 13, 2024 |2.0K Views

Find whether an array is subset of another array

Description
Discussion

Given two arrays: arr1[0..m-1] and arr2[0..n-1]. Find whether arr2[] is a subset of arr1[] or not. Both the arrays are not in sorted order. It may be assumed that elements in both array are distinct.

Input: arr1[] = {11, 1, 13, 21, 3, 7}, arr2[] = {11, 3, 7, 1} 
Output: arr2[] is a subset of arr1[]

Input: arr1[] = {1, 2, 3, 4, 5, 6}, arr2[] = {1, 2, 4} 
Output: arr2[] is a subset of arr1[]


Find whether an array is subset of another array : https://www.geeksforgeeks.org/find-whether-an-array-is-subset-of-another-array-set-1/