Company: Flipkart_9nov

Difficulty: medium

Problem Statement

Shortest Path Between Queried Colored Vertices 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. The total |V/2| (if V 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, Q 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 painter which are coloured 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 Z <= V <= 100 Z <= E <= 100 Z <= C <= 100 Input Format The first line of input contains two integers V and E separated

More Flipkart_9nov OA questionsInterview experiences