Find the Difference | 3 Approaches | Phone Interview | AMAZON | Leetcode - 389

preview_player
Показать описание
This is the 1st Video on our Leetcode Easy Playlist.
In this video we will try to solve a very famous Problem - Find the Difference (Leetcode-389).
These are generally asked in Phone Interviews and generally are good practice problems.

Problem Name : Find the Difference
Company Tags : AMAZON

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook
Рекомендации по теме
Комментарии
Автор

Insta ki reel ke through mujhe aapka pta chla and im in love with your channel❤

sachinadhikari
Автор

10K soon bro keep it up if its possible try to upload 1 system design video every weekend.

AnandKumar-kzls
Автор

Bhai can't thank you enough for your endless efforts. getting understanding of the approach to the question

amanjha
Автор

XOR method was goood! couldn't think of that!

class Solution {
public:
char findTheDifference(string s, string t) {
int ans = 0;
for(auto it:t){
ans+=(it-'a');
}
for(auto it:s){
ans-=(it-'a');
}
return ans+'a';
}
};

tsukuruuu
Автор

Still if i solved the questions i watch video and i find everytime time new, thanks for such content ❤️

saurabhKumar-hjyp
Автор

Awesome explanation gi do more videos along with concepts 100k soon

sumatheultimategirl
Автор

class Solution {
public:
char findTheDifference(string s, string t) {
for(int i=0;i<s.size();i++)
t[i+1]+=t[i]-s[i]; //Passing the diff: (t[i]-s[i]) to t[i+1]
return t[t.size()-1]; //The diff will be carried over to the last element eventually
}
};

k.vabhavmishra
Автор

My solution using map:

char findTheDifference(string s, string t) {
unordered_map<int, int> mp;
for(int i = 0; i < s.size(); i++){
mp[s[i]]++;
}

for(int i = 0; i < t.size(); i++){
if(mp.find(t[i]) == mp.end()){
return t[i];
}
else{
mp[t[i]]--;
if(mp[t[i]] == 0){
mp.erase(t[i]);
}
}
}
return 0;
}

But the XOR method was impressive...I have yet not done Bit Manipulation....so couldn't think of it

nonamenoname-xj
Автор

Solved this question, still came here to know MIK different approaches.

manaskhare
Автор

Please make video on trapping rain water

ManojKrVerma-vwdx
Автор

sir (mp.find(ch) == mp.end()) nii submit hoga .
maine bhi yehi kia tha sabse pehle kyuki character repeat karenge eslia map m present hoga.

shivamtomar
Автор

can you organize your playlist like for dsa where to start, i see here easy queston so i start from here from here where to jump or sequence of all,
can you give ?

onlygamingsamy
Автор

Kal ka LC-Contest ka last que ho skta h to video upload krdo bhaiya

harikrushnasuhagiya
Автор

4 more days left for September challange

taneyasoni
Автор

Bhaiya plss aap c++ ke basics fundamentals pdhado

sachinadhikari
Автор

How many videos left in graph concept and playlist?? How much time will it take to complete sir?

tejaspatel
Автор

1 question if I solve all questions from your DSA sheet does that means I cover all videos in your youtube channel for DSA questions . ?

shubhamcdacguidance
Автор

Sir what's a phone interview? Online test or something?

Ramneet
Автор

class Solution {
public:
char findTheDifference(string s, string t) {
int n=min(s.length(), t.length());
for(int i=0;i<n;i++)
{
if(s[i]!=t[i])
{
return t[i];
}
}
return t[n];
}
};

Why this code won.t work?

cseamisha