sir,
here is my code for Hackerearth question
“COLOR THE GRAPH”
it can pass only two test cases, with use of your code
here is the code, can you check it’s once
https://ide.codingblocks.com/s/65652
HackerEarth Question "Color the graph"
Hi Nishant, In graph , it is not mentioned that graph is connected.
So, Wrong test case
1
3 1
1 2
Your output
1
Correct output
2
as nodes 1 and 3 can be red colored and node 2 with blue color.
you can refer my code
https://ide.codingblocks.com/s/65846
Hit like if u get it 