459 - Graph Connectivity


Difficulty : easy

Solution Description :

Simple union-find problem

Just run union-find for each pair
and at last print the number of root or parent or sub-set or disjoint set
For A you can set 1, B->2, C->3 ............. Z->26