← All problemsSign in

Sagar and Islands

Pirate Sagar rules a famous sea with N islands. As he is constantly fleeing from the Navy, he has to run from one island to another. The paths and associated cost are given to Sagar in the form an adjacency matrix. The numbering of nodes is from 0 to N-1. Given Q queries as source U and destination node V, find the path of the lowest cost route from U to V. It is guaranteed that the least cost p

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start