Company: Flipkart_UI_IITB
Difficulty: medium
Asgard Flag Coloring Problem Description In Asgard, National Science day is approaching and flags of some colours are to be put at different cities. Task is to place the different coloured flags at each city such that no two neighbour cities have flags of the same colour and use as minimum number of different coloured flags as possible. In V cities and E roads connecting these V cities, two cities A and B are said to be consecutive if there is a road between A and B. Cities are numbered as 1 to V and there is a flag at every city. The colours are assigned according to the priority, i.e. the colour number, given below. 1 = Black 2 = Blue 3 = Green 4 = Aqua 5 = Red 6 = Purple 7 = Yellow 8 = White 9 = Gray 10 = Pink If city A is neighbour to cities B and C and also city B is neighbour to city C, all will be assigned different colour on a priority basis. When any new city D is added, again black colour is assigned to it, provided D is not neighbour to A. Thus, every time a new city is adde