539

Theory:

This is an np-hard problem. As the degree of each node can be at most 3 so using dfs ,it can be solved.

Follow the link

 

Leave a Reply

Your email address will not be published. Required fields are marked *