Posts

Showing posts with the label DFS

Beautiful Graph Problems

Cycle in a 2D graph with DFS Problem Link :  Fox And Two Dots Solution Idea : This problem can be solved using DFS. You can Check my  Solution  . Coloring a graph  Problem Link :  Coloring a Tree Solution Idea : Using DFS we can color a node and its subtree. We are coloring only subtrees. so we can't visit upwards of a tree while coloring. That's why we are using directed graph. if a tree is already colored in it's required color, we don't need to color it anymore. You can Check my  Solution . Also solved  Customized Chess Board  ( brute force approach )