Guys can someone help me with this problem.
An undirected graph with nodes representing cities in a country. Assume you have decided to build temples in this country, where the TASK is to build minimum number of temples such that each city has access to a temple in their own city or a neighbor city with a direct connection. Return number of minimum required temples. 
For the above example, Minimum number of temples required are 5 which are 3, 6, 10, 5, 12.

For the above example, Minimum number of temples required are 3 which are 1, 3, 5.