Haven't saw someone who is working so dedicatedly that requested for a concept and you released the video on the same day. HATSS OFF!!! Thanks a lot for this. 😍❣
40/40 done ✅ Finally thanks a lot Bhaiya ❤️ for this playlist. You helped a lot to overcome my fear of graphs. Aapka motivation wala intro boht sahi lagta hai ❤️. Looking forward for more videos in this playlist. And Congratulations Bhaiya for 10k subscribers 🥳. Love you 3000❤️
Amazing MIK❤ learnt something new before sleeping 😅.. aapke video ke liye hi pen and note hamesa bed ke side rakhta hun taki video and mera dry run ke bich dono sync rahe
as u said in eulerian circuit we can start from any node .... if we have a graph like at 13:15 so if we take the node having no edges and we start from it ...the condition for euler path that says we must visit all the edges is not met so how we say its an eulerian cycle
Wow. Good Qn. In such case, this what I would do Step 1: Ignore isolated vertices when checking for connectivity. Step 2: Verify that all vertices with edges have an even degree. Step 3: Start the traversal from any vertex within the connected component that contains edges.
Bhai 19:30 mai jho aapne bola visited once , vho exactly once nahi honga euclerian path ke liye ? I think something is going wrong . Ya mai hi galat samjha hu??
Hi bhaiya aaj ke contest me ye 4th question tha graphs ka agar aapko time mile toh isse bhi samjha dena and once again thanks a lot for guiding me coz for you i was able to rank 3k/28k in today's contest 😇. 2858. Minimum Edge Reversals So Every Node Is Reachable this was the question agar aapko online na mile toh leetcode contest se lelena.
Thank you so much for bringing this. I was looking for some Qns based on this topic so that i can cover them in this playlist. Surely I’ll cover. Thank you ❤️🙏😇
bhai pls reply krdo mai 4+ hour se iss problem ko try krra hun leetcode flood fill (733) iss solution ke sare given testcase run krre h but 134th test case error de rha h pls pls help bhaiya class Solution { public: vectordirections = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; bool isSafe(int row, int col, vector&grid){ if(row >= 0 && row < grid.size() && col >= 0 && col < grid[0].size()){ return true; } else{ return false; } } void BFS(vector& image, int sr, int sc, int color, map&visited){ visited[{sr, sc}] = true; queueq; q.push({sr, sc}); while(!q.empty()){ auto temp = q.front(); q.pop(); int x = temp.first; int y = temp.second; image[x][y] = color; for(auto & i : directions){ int newX = x + i[0]; int newY = y + i[1]; if(isSafe(newX, newY, image) && !visited[{newX, newY}] && image[newX][newY]){ q.push({newX, newY}); visited[{newX, newY}] = true; image[newX][newY] = color; } } } } vector floodFill(vector& image, int sr, int sc, int color) { if(color == image[sr][sc]){ return image; } mapvisited; // if(!visited[{sr, sc}]){ BFS(image, sr, sc, color, visited); // } return image; } };
Bhaiya pata hai thoda late ho gya hai aur thoda late comment hai par maine Euler Circuit ke alag tarike se solve kiya hai . Euler circuit wala GFG ka . Using DSU . class DSU : def __init__(self , n): self.parent = [i for i in range(n)] self.size = [1 for _ in range(n)]
def findParent(self , u): if self.parent[u] == u : return u parent = self.findParent(self.parent[u]) self.parent[u] = parent return parent
def union(self , u , v): parent_u = self.findParent(u) parent_v = self.findParent(v) if parent_u == parent_v : return 0 size_u = self.size[parent_u] size_v = self.size[parent_v] if size_v > size_u : self.parent[parent_u] = self.findParent(parent_v) self.parent[u] = self.findParent(parent_v) self.size[parent_v] += self.size[parent_u] else : self.parent[parent_v] = self.findParent(parent_u) self.parent[v] = self.findParent(parent_u) self.size[parent_u] += self.size[parent_v] return 1 class Solution: def isEularCircuitExist(self, v, adj): edges = [] for i in range(len(adj)): edges.extend([(i , j) for j in adj[i] if i < j ]) if len(edges) == 0 : return True dsu = DSU(v) for i in range(len(edges)): first = edges[i][0] second = edges[i][1] if dsu.findParent(first) == dsu.findParent(second): if i == len(adj) - 1 : return True else : return False else : dsu.union(first , second) return False Converted adj_list to edges to ( u, v) form . Now , for every edge , if the parent are different means we are not create new component , we are just exploring new path . agar parent same hue matlab we reached back to same component jisse start kiya tha , if that is last edge then True else False because we reached to same component and we have a cycle other than euler circuit . This passed all test cases and it works . Is this correct approach ?
Hello Shivam, Apologies for the inconvenience but TH-cam has removed our control to place ads. So unfortunately it’s out of our control to place ads. I hope you will understand ❤️❤️
I don't know why its underrated , its amazing
Haven't saw someone who is working so dedicatedly that requested for a concept and you released the video on the same day. HATSS OFF!!! Thanks a lot for this. 😍❣
Thank you so much ❤️🙏😇
40/40 done ✅ Finally thanks a lot Bhaiya ❤️ for this playlist. You helped a lot to overcome my fear of graphs. Aapka motivation wala intro boht sahi lagta hai ❤️. Looking forward for more videos in this playlist. And Congratulations Bhaiya for 10k subscribers 🥳. Love you 3000❤️
It means a lot to me. Thank you so much 😇🙏❤️
It’s a promise to bring more videos and more knowledge. ❤️❤️
@@codestorywithMIK My pleasure! 😇 Looking forward to the exciting content ahead. ❤❤
wow. How did you make Rs.40 comment ?
@@souravjoshi2293 you can also do it via the thanks button
Thx bhaiya for this beautiful explanation of this topic❤
Crazy!! How well you have explained this.
Bhai itna accha explain kiya hai tmne. Life me kabhi nahi bhulunga
A new subscriber is added
❤️🙏😇
Good explanation in eulerian path start have one out degree and end have three indegree
Amazing MIK❤ learnt something new before sleeping 😅.. aapke video ke liye hi pen and note hamesa bed ke side rakhta hun taki video and mera dry run ke bich dono sync rahe
Thank you 😇🙏❤️
Learned many new things!! Thank you
You are so welcome! 🙏
Thank you so much for listening to our requests. You the best
Now I can say Graph is easy. Eagerly waiting for upcoming videos like Articulation points and others. Time to practice questions 😅
Thanks Mik🥳🥳
So glad to hear that. Thank you so much 🙏😇❤️
And yes sure, more videos coming soon
as u said in eulerian circuit we can start from any node .... if we have a graph like at 13:15 so if we take the node having no edges and we start from it ...the condition for euler path that says we must visit all the edges is not met so how we say its an eulerian cycle
Wow. Good Qn.
In such case, this what I would do
Step 1: Ignore isolated vertices when checking for connectivity.
Step 2: Verify that all vertices with edges have an even degree.
Step 3: Start the traversal from any vertex within the connected component that contains edges.
Thanks a lot for starting Euler concepts. Waiting for Part-2 ❤❤
Waiting for part2, please upload soon, thanks sir!
Sure thing. Will upload as soon as I get back to India 😇🙏
13:58
Thanks❤❤
amazing sir
Thank you 🙏❤️😇
Wow, thanks a lot man
Bhai 19:30 mai jho aapne bola visited once , vho exactly once nahi honga euclerian path ke liye ? I think something is going wrong . Ya mai hi galat samjha hu??
Pls Make a video on finding connected components in a directed graph. i.e. both Kosaraju's and Tarjan's Algorithm.
Both Kosaraju’s algorithm is already there in my playlist - th-cam.com/video/E6DeC0Zpdns/w-d-xo.htmlsi=jblQpHpplb7lKU0k
❤️❤️❤️
You are dope 🔥❣
bhaiya maine ye vala lecture complete kr diya h now waiting for new videos and DSA sheet of yours
Sure thing.
Thank you so much 😇😇❤️❤️❤️
Wow 😲.
Hi bhaiya aaj ke contest me ye 4th question tha graphs ka agar aapko time mile toh isse bhi samjha dena and once again thanks a lot for guiding me coz for you i was able to rank 3k/28k in today's contest 😇.
2858. Minimum Edge Reversals So Every Node Is Reachable
this was the question agar aapko online na mile toh leetcode contest se lelena.
Thank you so much for bringing this. I was looking for some Qns based on this topic so that i can cover them in this playlist. Surely I’ll cover.
Thank you ❤️🙏😇
bhai pls reply krdo mai 4+ hour se iss problem ko try krra hun leetcode flood fill (733)
iss solution ke sare given testcase run krre h but 134th test case error de rha h pls pls help bhaiya
class Solution {
public:
vectordirections = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool isSafe(int row, int col, vector&grid){
if(row >= 0 && row < grid.size() && col >= 0 && col < grid[0].size()){
return true;
}
else{
return false;
}
}
void BFS(vector& image, int sr, int sc, int color, map&visited){
visited[{sr, sc}] = true;
queueq;
q.push({sr, sc});
while(!q.empty()){
auto temp = q.front();
q.pop();
int x = temp.first;
int y = temp.second;
image[x][y] = color;
for(auto & i : directions){
int newX = x + i[0];
int newY = y + i[1];
if(isSafe(newX, newY, image) && !visited[{newX, newY}] && image[newX][newY]){
q.push({newX, newY});
visited[{newX, newY}] = true;
image[newX][newY] = color;
}
}
}
}
vector floodFill(vector& image, int sr, int sc, int color) {
if(color == image[sr][sc]){
return image;
}
mapvisited;
// if(!visited[{sr, sc}]){
BFS(image, sr, sc, color, visited);
// }
return image;
}
};
Bhaiya pata hai thoda late ho gya hai aur thoda late comment hai par maine Euler Circuit ke alag tarike se solve kiya hai . Euler circuit wala GFG ka . Using DSU .
class DSU :
def __init__(self , n):
self.parent = [i for i in range(n)]
self.size = [1 for _ in range(n)]
def findParent(self , u):
if self.parent[u] == u :
return u
parent = self.findParent(self.parent[u])
self.parent[u] = parent
return parent
def union(self , u , v):
parent_u = self.findParent(u)
parent_v = self.findParent(v)
if parent_u == parent_v :
return 0
size_u = self.size[parent_u]
size_v = self.size[parent_v]
if size_v > size_u :
self.parent[parent_u] = self.findParent(parent_v)
self.parent[u] = self.findParent(parent_v)
self.size[parent_v] += self.size[parent_u]
else :
self.parent[parent_v] = self.findParent(parent_u)
self.parent[v] = self.findParent(parent_u)
self.size[parent_u] += self.size[parent_v]
return 1
class Solution:
def isEularCircuitExist(self, v, adj):
edges = []
for i in range(len(adj)):
edges.extend([(i , j) for j in adj[i] if i < j ])
if len(edges) == 0 :
return True
dsu = DSU(v)
for i in range(len(edges)):
first = edges[i][0]
second = edges[i][1]
if dsu.findParent(first) == dsu.findParent(second):
if i == len(adj) - 1 :
return True
else :
return False
else :
dsu.union(first , second)
return False
Converted adj_list to edges to ( u, v) form .
Now , for every edge , if the parent are different means we are not create new component , we are just exploring new path . agar parent same hue matlab we reached back to same component jisse start kiya tha , if that is last edge then True else False because we reached to same component and we have a cycle other than euler circuit .
This passed all test cases and it works .
Is this correct approach ?
❤❤❤
Thank you 🙏❤️😇
kal ka question isi concept par tha!
I think parso wala qn tha. Reconstruct itinerary wala shayad.
Yes reconnect itineraries base on eluerian path
@@FanIQQuiz mai just Raat ke 3 baje baad code krta hu😅
@@k.vabhavmishra damn 😅
POTD
Here it is -
th-cam.com/video/ElXqjhZoUC0/w-d-xo.htmlsi=M_aVKMkJmBXfdeEL
Hope this helps 😇🙏❤️
Bro today's potd
th-cam.com/video/m73DRkEo8Ko/w-d-xo.htmlsi=aRyeK2wZk2aZb2tK
❤️
Where is today's daily challenge question ???
It’s already there in my Playlist long ago.
You can watch here th-cam.com/video/QIu9HeyEjPc/w-d-xo.htmlsi=I3lsO_TKQDuif79S
Thank you 🙏❤️😇
bhai ads ko video ke 1st ya last mein laga diya karo!...it's very annoying
Hello Shivam,
Apologies for the inconvenience but TH-cam has removed our control to place ads. So unfortunately it’s out of our control to place ads.
I hope you will understand ❤️❤️
@@codestorywithMIK okay!
sir I got 500 day strak medal
🎊🎊🎉🎉 Awesome
O O--O
\ /
O
Hi MIK, If we start from the 1st component, we never reach any edge of 2nd component, then why are we saying this as a eulerian graph