Company: Flipkart_12july

Difficulty: medium

Problem Statement

Graph Shortest Path by Color Query Problem Description Consider an undirected weighted graph G(V,E) where V and E are the number of vertices and edges respectively. The vertices of the graph are coloured. Two vertices in the graph make a pair and are of same colour, thus V/2 (if V is even) or (V+1)/2 (if V is odd) pairs are present in G and same number of colours are used, as each pair has a different colour. A query is thrown which is basically a colour used among the pairs of vertices. Write a program to determine the shortest path (according to the weight) from one vertex to its partner which are determined with the same colour given in Q. Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere in the program, as these contribute to the standard output and testcases will fail. Constraints 2 ≤ V ≤ 100 1 ≤ E ≤ 100 Input Format The first line of input contains two integers V and E separated by single white space, where V is the numb

More Flipkart_12july OA questionsInterview experiences