Data Structures & Algorithms Detect Cycle in a Directed Graph3 Mins Read See how to solve “detect cycle in a directed graph” using depth-first search and two helper arrays. Simple idea, commented…
Data Structures & Algorithms Is Graph Bipartite? | Leetcode 785 | Easy 2-Color DFS Solution in Python4 Mins Read Learn how to test if an undirected graph is bipartite by coloring it with two colors. Simple DFS idea, commented…
Data Structures & Algorithms Number of Islands | Leetcode 200 | Explained using BFS and DFS4 Mins Read Learn how to count the number of islands (leetcode 200) in a 2-D grid using both Breadth-First Search (BFS) and…