Find Whether One Array is Subset of Another Array

preview_player
Показать описание
JOIN ME
—————

COMPLETE PLAYLIST
————————————

INTERVIEW PLAYLIST
————————————

QUICK SHORT VIDEOS
————————————-

Time Lines
=========
0:05 Introduction
0:45 Brute Force Approach
1:50 Example Code Explanation

In this video we will learn about how to find one array is subset of another array. This is an interview questions and can be solved in multiple ways. I have explained almost all the ways.

The best way is that we can maintain a frequency array and verify the frequency and keep decrementing the frequency once found, this we it is robust enough to check duplicate subset and would give you a correct output.

#array #interview #dsa #algorithms #datastructure
Рекомендации по теме
Комментарии
Автор

We can also sort array and do binary search, time complexity would be nlogn, this approach can be considered in interview before moving on to hash approach

alienx
Автор

We can use another hash map for the subarray to solve the problem of the duplicates and the complexity here would be also O(m+n)

stoka
Автор

sir, what if array's element is negative

shubhankarnath