We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here, I think the main aim is to indentify the fact that the maximum distance for visiting successing cities after visiting the first city, will always be equal to maximum possible distance between any two nodes, which has to be only calculated for once.
Hence, we only have to calculate the distance to the starting city (V), and then add the previously calculated maximum distance for the remaining count of cities.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Journey Scheduling
You are viewing a single comment's thread. Return to all comments →
Here, I think the main aim is to indentify the fact that the maximum distance for visiting successing cities after visiting the first city, will always be equal to maximum possible distance between any two nodes, which has to be only calculated for once. Hence, we only have to calculate the distance to the starting city (V), and then add the previously calculated maximum distance for the remaining count of cities.