Day-7: Solution
Evaluate Division
Leetcode #399
Algorithm: Disjoint Set
SOLUTION code: https://gist.github.com/SuryaPratapK/b4ea37a86814d08856b4cd4ef41c640f
Video for Disjoint Set (Union & Find): https://youtu.be/eTaWFhPXPz4
Video for Disjoint Set (Union by RANK & Find->Path Compression): https://youtu.be/kaBX2s3pYO4
LOGIC:
1 Build a bidirectional graph with weight as: (If a=4 and b=2 then, a->b (edge wt=4/2) and b->a (edge wt=2/4))
2 For any given a/c, start traversing from a and try reaching c (a/b * b/c = a/c). Keep multiplying values while traversing.
Please go through the video to understand Disjoint Set and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Evaluate Division
Leetcode #399
Algorithm: Disjoint Set
SOLUTION code: https://gist.github.com/SuryaPratapK/b4ea37a86814d08856b4cd4ef41c640f
Video for Disjoint Set (Union & Find): https://youtu.be/eTaWFhPXPz4
Video for Disjoint Set (Union by RANK & Find->Path Compression): https://youtu.be/kaBX2s3pYO4
LOGIC:
1 Build a bidirectional graph with weight as: (If a=4 and b=2 then, a->b (edge wt=4/2) and b->a (edge wt=2/4))
2 For any given a/c, start traversing from a and try reaching c (a/b * b/c = a/c). Keep multiplying values while traversing.
Please go through the video to understand Disjoint Set and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Evaluate Division - LeetCode
Can you solve this real interview question? Evaluate Division - You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is…
Day-8: (Solution)
Detonate the Maximum Bombs
Leetcode #2101
Algorithm: BFS
BFS: https://youtu.be/YYq38LTz774
SOLUTION code: https://gist.github.com/SuryaPratapK/36c06f73ce2348fae189190aa52d7fdd
LOGIC:-
1 Make adjacency list using bombs in range of a bomb as adjacent bombs
2 Apply BFS from all bombs and track max depth of BFS call.
Please go through the video to understand BFS and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Detonate the Maximum Bombs
Leetcode #2101
Algorithm: BFS
BFS: https://youtu.be/YYq38LTz774
SOLUTION code: https://gist.github.com/SuryaPratapK/36c06f73ce2348fae189190aa52d7fdd
LOGIC:-
1 Make adjacency list using bombs in range of a bomb as adjacent bombs
2 Apply BFS from all bombs and track max depth of BFS call.
Please go through the video to understand BFS and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Detonate the Maximum Bombs - LeetCode
Can you solve this real interview question? Detonate the Maximum Bombs - You are given a list of bombs. The range of a bomb is defined as the area where its effect can be felt. This area is in the shape of a circle with the center as the location of the bomb.…
Day-9:
Is Graph Bipartite?
Leetcode #785
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
Please go through the video to understand BFS and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Is Graph Bipartite?
Leetcode #785
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
Please go through the video to understand BFS and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Is Graph Bipartite? - LeetCode
Can you solve this real interview question? Is Graph Bipartite? - There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More…
Day-9: (Solution)
Is Graph Bipartite?
Leetcode #785
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
SOLUTION code: https://gist.github.com/SuryaPratapK/e7a6d806c218f81453f9fd61d41cec30
Please go through the video to understand Bipartite Graph and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Is Graph Bipartite?
Leetcode #785
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
SOLUTION code: https://gist.github.com/SuryaPratapK/e7a6d806c218f81453f9fd61d41cec30
Please go through the video to understand Bipartite Graph and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Is Graph Bipartite? - LeetCode
Can you solve this real interview question? Is Graph Bipartite? - There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More…
Day-10:
Possible Bipartition
Leetcode #886
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
Please go through the video only after trying the problem yourself to understand Bipartite Graph and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Possible Bipartition
Leetcode #886
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
Please go through the video only after trying the problem yourself to understand Bipartite Graph and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Possible Bipartition - LeetCode
Can you solve this real interview question? Possible Bipartition - We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some other people, and they should not go into the same group.
Given the integer…
Given the integer…
Day-10: (Solution)
Possible Bipartition
Leetcode #886
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
SOLUTION code: https://gist.github.com/SuryaPratapK/4c9ad30caa5f3c8b6c1249b0ed664e72
Please go through the video only after trying the problem yourself to understand Bipartite Graph and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Possible Bipartition
Leetcode #886
Algorithm: Bipartite Graph
Bipartite Graph: https://youtu.be/0ACfAqs8mm0
SOLUTION code: https://gist.github.com/SuryaPratapK/4c9ad30caa5f3c8b6c1249b0ed664e72
Please go through the video only after trying the problem yourself to understand Bipartite Graph and then implement in the problem 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Possible Bipartition - LeetCode
Can you solve this real interview question? Possible Bipartition - We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some other people, and they should not go into the same group.
Given the integer…
Given the integer…
Day-11:
Graph Valid Tree
Leetcode #886
Read : When can we call a Graph as TREE ?
Please try the problem yourself and read the properties for a GRAPH to be called a tree 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Graph Valid Tree
Leetcode #886
Read : When can we call a Graph as TREE ?
Please try the problem yourself and read the properties for a GRAPH to be called a tree 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Graph Valid Tree - LeetCode
Can you solve this real interview question? Graph Valid Tree - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Day-11: (Solution)
Graph Valid Tree
Leetcode #886
Read : When can we call a Graph as TREE ?
SOLUTION code: https://gist.github.com/SuryaPratapK/e9d3dc3063b8c64805ff8adbfcf4cef5
Steps:-
A graph is TREE when:-
1 It is connected (has only 1 component)
2 It has no cycle
Please try the problem yourself and read the properties for a GRAPH to be called a tree 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Graph Valid Tree
Leetcode #886
Read : When can we call a Graph as TREE ?
SOLUTION code: https://gist.github.com/SuryaPratapK/e9d3dc3063b8c64805ff8adbfcf4cef5
Steps:-
A graph is TREE when:-
1 It is connected (has only 1 component)
2 It has no cycle
Please try the problem yourself and read the properties for a GRAPH to be called a tree 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Graph Valid Tree - LeetCode
Can you solve this real interview question? Graph Valid Tree - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Day-12:
Parallel Courses
Leetcode #1136
Algorithm: Topological Sort
Explanation Video: https://youtu.be/qe_pQCh09yU
Please try the problem yourself and watch the video to learn topological sort 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Parallel Courses
Leetcode #1136
Algorithm: Topological Sort
Explanation Video: https://youtu.be/qe_pQCh09yU
Please try the problem yourself and watch the video to learn topological sort 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Parallel Courses - LeetCode
Can you solve this real interview question? Parallel Courses - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Day-12: (Solution)
Parallel Courses
Leetcode #1136
Algorithm: Topological Sort
Topological Sort: https://youtu.be/qe_pQCh09yU
SOLUTION code: https://gist.github.com/SuryaPratapK/a724fe7d30957c11f17abf35ae8be38b
Please try the problem yourself and watch the video to learn topological sort 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Parallel Courses
Leetcode #1136
Algorithm: Topological Sort
Topological Sort: https://youtu.be/qe_pQCh09yU
SOLUTION code: https://gist.github.com/SuryaPratapK/a724fe7d30957c11f17abf35ae8be38b
Please try the problem yourself and watch the video to learn topological sort 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Parallel Courses - LeetCode
Can you solve this real interview question? Parallel Courses - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Day-13:
Path with Maximum Probability
Leetcode #1136
Algorithm: Dijkstra Algo
Dijkstra Explained: https://youtu.be/Sj5Z-jaE2x0
Please try the problem yourself and watch the video to learn Dijkstra Algorithm 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Path with Maximum Probability
Leetcode #1136
Algorithm: Dijkstra Algo
Dijkstra Explained: https://youtu.be/Sj5Z-jaE2x0
Please try the problem yourself and watch the video to learn Dijkstra Algorithm 🙂
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Path with Maximum Probability - LeetCode
Can you solve this real interview question? Path with Maximum Probability - You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a probability…
Day-13: (Solution)
Path with Maximum Probability
Leetcode #1136
Algorithm: Dijkstra Algo
Dijkstra Explained: https://youtu.be/Sj5Z-jaE2x0
Solution CODE: https://gist.github.com/SuryaPratapK/c5a36ce6d331de94b367495354fbe4da
Please try the problem yourself and watch the video to learn Dijkstra Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Path with Maximum Probability
Leetcode #1136
Algorithm: Dijkstra Algo
Dijkstra Explained: https://youtu.be/Sj5Z-jaE2x0
Solution CODE: https://gist.github.com/SuryaPratapK/c5a36ce6d331de94b367495354fbe4da
Please try the problem yourself and watch the video to learn Dijkstra Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Path with Maximum Probability - LeetCode
Can you solve this real interview question? Path with Maximum Probability - You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a probability…
Day-14:
Course Schedule IV
Leetcode #1462
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Course Schedule IV
Leetcode #1462
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Course Schedule IV - LeetCode
Can you solve this real interview question? Course Schedule IV - There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take…
Day-14: (Solution)
Course Schedule IV
Leetcode #1462
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Solution CODE: https://gist.github.com/SuryaPratapK/f30a92fb2f8a6fead594f59d122227f8
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Course Schedule IV
Leetcode #1462
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Solution CODE: https://gist.github.com/SuryaPratapK/f30a92fb2f8a6fead594f59d122227f8
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Course Schedule IV - LeetCode
Can you solve this real interview question? Course Schedule IV - There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take…
Day-15:
Find the City With the Smallest Number of Neighbors at a Threshold Distance
Leetcode #1334
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Find the City With the Smallest Number of Neighbors at a Threshold Distance
Leetcode #1334
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Find the City With the Smallest Number of Neighbors at a Threshold Distance - LeetCode
Can you solve this real interview question? Find the City With the Smallest Number of Neighbors at a Threshold Distance - There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and…
Day-15: (Solution)
Find the City With the Smallest Number of Neighbors at a Threshold Distance
Leetcode #1334
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Solution CODE: https://gist.github.com/SuryaPratapK/110cf5701e084dd70314cd147f241ee2
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Find the City With the Smallest Number of Neighbors at a Threshold Distance
Leetcode #1334
Algorithm: Floyd Warshall
Floyd Warshall Algo Explained: https://youtu.be/nV_wOZnhbog
Solution CODE: https://gist.github.com/SuryaPratapK/110cf5701e084dd70314cd147f241ee2
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Find the City With the Smallest Number of Neighbors at a Threshold Distance - LeetCode
Can you solve this real interview question? Find the City With the Smallest Number of Neighbors at a Threshold Distance - There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and…
Day-16:
Min Cost to Connect All Points
Leetcode #1584
Algorithm: Prims/Kruskals MST (Minimum Spanning Tree)
Prims MST Algo Explained: https://youtu.be/xthRL0lcx2w
Kruskal’s MST Algo Explained: https://youtu.be/_Iz-QLBGKpM
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Min Cost to Connect All Points
Leetcode #1584
Algorithm: Prims/Kruskals MST (Minimum Spanning Tree)
Prims MST Algo Explained: https://youtu.be/xthRL0lcx2w
Kruskal’s MST Algo Explained: https://youtu.be/_Iz-QLBGKpM
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Min Cost to Connect All Points - LeetCode
Can you solve this real interview question? Min Cost to Connect All Points - You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi].
The cost of connecting two points [xi, yi] and [xj, yj]…
The cost of connecting two points [xi, yi] and [xj, yj]…
Day-16: (Solution)
Min Cost to Connect All Points
Leetcode #1584
Algorithm: Prims/Kruskals MST (Minimum Spanning Tree)
Prims MST Algo Explained: https://youtu.be/xthRL0lcx2w
Kruskal’s MST Algo Explained: https://youtu.be/_Iz-QLBGKpM
Solution CODE: https://gist.github.com/SuryaPratapK/9fc73aa84c70ba77bb00bae3b18f2bfb
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
Min Cost to Connect All Points
Leetcode #1584
Algorithm: Prims/Kruskals MST (Minimum Spanning Tree)
Prims MST Algo Explained: https://youtu.be/xthRL0lcx2w
Kruskal’s MST Algo Explained: https://youtu.be/_Iz-QLBGKpM
Solution CODE: https://gist.github.com/SuryaPratapK/9fc73aa84c70ba77bb00bae3b18f2bfb
Please try the problem yourself and watch the video to learn the Algorithm 🙂
Please SHARE this initiative with your friends as well 😀
#30DaysOfGraph #techdose #interviewpreparation #graphs #dsa
LeetCode
Min Cost to Connect All Points - LeetCode
Can you solve this real interview question? Min Cost to Connect All Points - You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi].
The cost of connecting two points [xi, yi] and [xj, yj]…
The cost of connecting two points [xi, yi] and [xj, yj]…