350. Intersection of Two Arrays II | hashing | leetcode daily challenge | DSA | Hindi

preview_player
Показать описание
Problem Name:
350. Intersection of Two Arrays II

Problem Statement:
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.

Problem link:

Java Plus DSA Placement Course Playlist:

Java Plus DSA Sheet:

Notes:

Telegram Link:

Ultimate Recursion Series Playlist:

Samsung Interview Experience:

Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung

Timestamp:
0:00 - Introduction

#ShashwatTiwari #coding​​ #problemsolving​
Рекомендации по теме
Комментарии
Автор

Best ever..move ahead sir complete full java along with advance...because no one is providing java playlist...everyone go towards c++

Elitevisioner
Автор

maine aapse pehle seekha tha intersection of two arrays 1 toh mujhse aaj ka khud hi ban gya tha bhaiya😍

PiyushSharma-weyd
Автор

bhai please apni DSA wali series continue kro na...

Ashwinmahajan-ldqt
Автор

class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
int arr[1001] = {0};
vector<int>ans;
for(int a:nums1) arr[a]++;
for(int b:nums2)
{
if(arr[b]>0)
{
ans.push_back(b);
arr[b]--;
}
}
return ans;
}
};
time O(n) space O(1)

dibbodas
welcome to shbcf.ru