You know you understand the logic when you get the intuition at 6:30 Thanks for this amazing tutorial, also the way you explained yesterday's question "Island Perimeter" made this question a cake walk.
Learning graph from codestorywithMIK taught me to dig deeper in the problem and practice to grasp concept....I tried this with DFS / BFS and Union Find, below is my Union find code :- Major learning converting 2D matrix cell into indexes by apply formula - cell (i,j) = i * m (no. of col) + j class Solution { public: class DSU { private: vectorparent; vectorrank; int count; public: //constructor DSU(int n){ parent.resize(n); rank.resize(n,0); count = 0; for(int i=0;i rank[Py]){ parent[Py] = Px; } else if(rank[Py] > rank[Px]){ parent[Px] = Py; } else{ parent[Px] = Py; rank[Py]++; } count--; //count reduced as 2 components are merged into 1. } void inc(){ count++; } int getCount(){ return count; } }; int numIslands(vector& grid) { int n = grid.size(); int m = grid[0].size(); DSU uf(n*m);//returns n in DSU class //get total count of island by counting 1's in grid for(int i=0;i
bhai duniya ke saare question upload krdo nn, it becomes really painful jab koi question smjh na aa rha ho and then there's no solution from your side.
Actually it’s a Premium problem, but available on gfg and lintcode github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
I think I have not created video for that. But you can find the code in my github repo. But there is a video for another similar problem - Number of Closed Islands | Story to code | Google | Leetcode 1254 | codestorywithMIK th-cam.com/video/dMn6NPk9nPw/w-d-xo.html
Actually it’s a Premium problem, but available on gfg and lintcode github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
Actually it’s a Premium problem, but available on gfg and leetcode. I have posted Qn also in the link below - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
🐐 salute to consistency 🙌
You know you understand the logic when you get the intuition at 6:30 Thanks for this amazing tutorial, also the way you explained yesterday's question "Island Perimeter" made this question a cake walk.
Learning graph from codestorywithMIK taught me to dig deeper in the problem and practice to grasp concept....I tried this with DFS / BFS and Union Find, below is my Union find code :-
Major learning converting 2D matrix cell into indexes by apply formula - cell (i,j) = i * m (no. of col) + j
class Solution {
public:
class DSU {
private:
vectorparent;
vectorrank;
int count;
public:
//constructor
DSU(int n){
parent.resize(n);
rank.resize(n,0);
count = 0;
for(int i=0;i rank[Py]){
parent[Py] = Px;
}
else if(rank[Py] > rank[Px]){
parent[Px] = Py;
}
else{
parent[Px] = Py;
rank[Py]++;
}
count--; //count reduced as 2 components are merged into 1.
}
void inc(){
count++;
}
int getCount(){
return count;
}
};
int numIslands(vector& grid) {
int n = grid.size();
int m = grid[0].size();
DSU uf(n*m);//returns n in DSU class
//get total count of island by counting 1's in grid
for(int i=0;i
thank you mik - Day 2 of solving dsa everyday
Mik is just reducing his watch time by teaching so brilliantly lol.
kudos to your hardwork sir
amazing sir
dheere dheere apke solution dheke problem ko approach karna sikh rha hu
keep it up sir 🙂
could solve this on my own, thanks to you
Amazing explanation
Thanks a lot bhaiya ❤❤
bhai duniya ke saare question upload krdo nn, it becomes really painful jab koi question smjh na aa rha ho and then there's no solution from your side.
Understand the intution
Bro I solved the problem "number of distinct Islands" on my own.
is there any reward ??😊😎🙏
iske liye koi simplest approach nahi hai , like the iterative approach?
Actually an island in the gird can be of any form which can only be explored using BFS or DFS .
An iterative solution will not be possible.
Bro there's a question named "Number of Distinct Islands" in both LC & GFG.
But in LC it's a premium question.
Yes it’s premium but available on gfg and lintcode
github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
Bhaiya "Find unique island" ka question kha per hai , leetcode me to nhi dikh rha hai.
Actually it’s a Premium problem, but available on gfg and lintcode
github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
Theek hai bhaiya 👍
Bro there's no question like "Find Unique Islands". Pls give the question link
github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
Find the unique islands link??
I think I have not created video for that.
But you can find the code in my github repo.
But there is a video for another similar problem -
Number of Closed Islands | Story to code | Google | Leetcode 1254 | codestorywithMIK
th-cam.com/video/dMn6NPk9nPw/w-d-xo.html
Actually it’s a Premium problem, but available on gfg and lintcode
github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
public int numIslands(char[][]grid){
int cnt=0;
for(int i=0;i
Anyone with the hw question link?
Actually it’s a Premium problem, but available on gfg and leetcode.
I have posted Qn also in the link below -
github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Graph/Number%20of%20Distinct%20Islands
@@codestorywithMIK oh okay sir thank you so much! 🙇♀️❤
In every video you say "Medium Mark h bilkul easy h" and in case hard problem "hard Mark h but medium h"😂😂
To boost our confidence 😁❤️😇
❣
CTC