Lucky Numbers in a Matrix | 2 Approaches | Dry Run | Leetcode 1380 | codestorywithMIK

  Рет қаралды 4,916

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 32
@biswarupacharjya2258
@biswarupacharjya2258 6 ай бұрын
The Best thing of this video is You expln Approach 1 to understand the logic but also expln the Approach 2 to optimized this problem this proves your dedication level for us . thank you
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
❤️❤️🙏🙏
@abhirajsingh3071
@abhirajsingh3071 3 ай бұрын
Loved it, did not expected that someone will explain this so smoothly, thanks
@gui-codes
@gui-codes 6 ай бұрын
I solved it on my own. Thanks a lot mik for helping me being consistent.
@ganeshjaggineni4097
@ganeshjaggineni4097 6 ай бұрын
NICE SUPER EXCELLENT MOTIVATED
@jeehub041
@jeehub041 6 ай бұрын
Sir aapke explanations gajab ha, aap Great ho agar kisi ko coding me interest na ho aur voh ek baar aapka teaching delh le 🙌🙌
@nupurkuhite4967
@nupurkuhite4967 6 ай бұрын
Sir, Thanks jo aap ka 2nd approach hai vo que padhane ke baad mujhe bhi ye idea aya tha lekin mene shrif rowMin ka Max value nikala tha, colMax ka Min nahi islye answer wrong aya tha. Thanks to resolve my doubt.
@anuragsingh2556
@anuragsingh2556 6 ай бұрын
sir i have one doubt i wish you reply to this comment when we add answer in our result you used this condition if (matrix[row][col] == rowMin.get(row) && matrix[row][col] == colMax.get(col)) { result.add(matrix[row][col]); } but i used if(matrix[i][j] == min.get(i) && min.get(i) == max.get(j)) ans.add(min.get(i)); } how these both condition are different
@RohitKumar-dz8dh
@RohitKumar-dz8dh 6 ай бұрын
Thanks 😊
@ryuu5768
@ryuu5768 6 ай бұрын
class Solution { public: pairfindmin(vector& matrix,int &i){ int mini=INT_MAX; int index=-1; for(int j=0;jmatrix[i][j]){ index=j; mini=matrix[i][j]; } } return {mini,index}; } bool ismaxincol(vector& matrix,int maxi,int j){ for(int i=0;i
@_A__Mohit
@_A__Mohit 6 ай бұрын
Please segment tree videos sir please 😢 🙏🙏🙏🙏
@nesh398
@nesh398 6 ай бұрын
Without using 2 seperate arrays use MAP class Solution { public: vector luckyNumbers(vector& matrix) { int n = matrix.size(); int m = matrix[0].size(); unordered_map holder; vector ans; for (int i = 0; i < n; i++) { int mini = INT_MAX; for (int j = 0; j < m; j++) { mini = min(mini, matrix[i][j]); } holder[mini]++; } for (int i = 0; i < m; i++) { int maxi = INT_MIN; for (int j = 0; j < n; j++) { maxi = max(maxi, matrix[j][i]); } holder[maxi]++; } for (auto elem : holder) { if (elem.second == 2) { return {elem.first}; } } return 0; } };
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Very nice ❤️
@gauravbanerjee2898
@gauravbanerjee2898 6 ай бұрын
Thanks a lot bhaiya ❤❤
@thefinalfit
@thefinalfit 6 ай бұрын
Done on my own 😊
@utkarshsahay9908
@utkarshsahay9908 6 ай бұрын
class Solution { public: vector luckyNumbers (vector& matrix) { unordered_map mp; vector ans; for(int i = 0;i < matrix.size(); i++){ int mini = *min_element(begin(matrix[i]),end(matrix[i])); int idx = min_element(begin(matrix[i]),end(matrix[i])) - begin(matrix[i]); mp[mini] = idx; } for(auto it : mp){ int ele = it.first; int col = it.second; int maxi = INT_MIN; for(int row = 0;row < matrix.size(); row++){ maxi = max(maxi,matrix[row][col]); } if(maxi == ele) ans.push_back(ele); } return ans; } };❤❤
@YashMalav-kh1ov
@YashMalav-kh1ov 6 ай бұрын
first viewer...🙂
@reyazahmed4855
@reyazahmed4855 6 ай бұрын
Dfs approach for number of good leaves yesterday problem please upload
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Yes, planning this soon by tomorrow
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Coming today only 🙂❤️
@reyazahmed4855
@reyazahmed4855 6 ай бұрын
​@@codestorywithMIK Thanks buddy. Hope you doing great. Awesome channel
@j_ourney25
@j_ourney25 6 ай бұрын
Can we write in if condition if(rowmin[row] == colmax[col]{ }
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Definitely yes 👍🏻
@nawazthezaifre8870
@nawazthezaifre8870 6 ай бұрын
Array + Matrix = dimag ghum jata hai konsa loop kha chlega solution dekh lo samjh aa jata hai nhi to solve nhi hote is type ke question.
@singhshek58
@singhshek58 6 ай бұрын
vector luckyNumbers (vector& matrix) { int n=matrix.size(); int m=matrix[0].size(); unordered_setst; for(int i=0;i
@ryuu5768
@ryuu5768 6 ай бұрын
class Solution { public: pairfindmin(vector& matrix,int &i){ int mini=INT_MAX; int index=-1; for(int j=0;jmatrix[i][j]){ index=j; mini=matrix[i][j]; } } return {mini,index}; } bool ismaxincol(vector& matrix,int maxi,int j){ for(int i=0;i
@TheBusaSinger
@TheBusaSinger 6 ай бұрын
❤❤
@maniBrave
@maniBrave 6 ай бұрын
java wale kitne h wsese
@aggarwalsachin4854
@aggarwalsachin4854 6 ай бұрын
ye contradiction wala logic kaise aya bro dimaag m???
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Hi there, It was a hit and trial initially. I also realised for any example i was always getting one Lucky number. And hence came to this. Hope it helped 😊❤️🙏
@shabananoor9423
@shabananoor9423 6 ай бұрын
❤❤❤
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Lucky Numbers in a Matrix - Leetcode 1380 - Python
16:21
NeetCodeIO
Рет қаралды 8 М.
one year of studying (it was a mistake)
12:51
Jeffrey Codes
Рет қаралды 203 М.
Knuth-Morris-Pratt KMP String Matching Algorithm | Search Pattern | GFG POTD
1:05:36
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН