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.
The cost of the path here is defined as the max weigth of any edge in that path,
Since path between 1-3 is: 1-4-3
where weight (1-4) = 2
weight (4-3) = 1
hence the max weight (1-4) which is 2 is the cost of the path: 1-4-3
And since 2 lies in the range [1,2] therefore path {1,3} is also included in it.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Super Maximum Cost Queries
You are viewing a single comment's thread. Return to all comments →
The cost of the path here is defined as the max weigth of any edge in that path, Since path between 1-3 is: 1-4-3 where weight (1-4) = 2 weight (4-3) = 1 hence the max weight (1-4) which is 2 is the cost of the path: 1-4-3
And since 2 lies in the range [1,2] therefore path {1,3} is also included in it.