Atlas | 30 Sep 2024 | Graph Challenge

Question · Posted Apr 2026

Graph Challenge Problem Statement: Have the function GraphChallenge(strArr) read strArr which will be a representation of an undirected graph in a form similar to an adjacency list. Each element in the input will contain an integer which will represent the population for that city, and then that will be followed by a comma separated list of its neighboring cities and their populations (these will be separated by a colon). For example: strArr may be ["1:[5]", "4:[5]", "3:[5]", "5:[1,4,3,2]", "2:[5,15,7]", "7:[2,8]", ...

The full answer & interview discussion are available to premium members.

Log in Create a free account