• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
June 14, 2022 |27.9K Views

Array Subset of another array | SDE Sheet | Hashing

Description
Discussion

In this video we will see when given two arrays: arr1[0..m-1] and arr2[0..n-1], how to 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.

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

Check out the video to see how we implement this!!


Practice Problem: https://practice.geeksforgeeks.org/problems/array-subset-of-another-array2317/1
Article: https://www.geeksforgeeks.org/find-whether-an-array-is-subset-of-another-array-set-1/
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/