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 )

Comments

Popular posts from this blog

Appleman and Tree - CF 461B

Lightoj 1236 - Pairs Forming LCM

A Simple Kruskal Algorithm