I have got the solution for small p by calculating Dist [u] [i] for i=0 to p-1 using Dijkstra.. how to solve it such that the solution is independent of the value of p.
https://leetcode.com/tag/graph https://leetcode.com/tag/dynamic-programming https://hackerearth.com
Auto comment: topic has been updated by Rehmaan_2001 (previous revision, new revision, compare).
Auto comment: topic has been updated by Rehmaan_2001 (previous revision, new revision, compare).
Auto comment: topic has been updated by Rehmaan_2001 (previous revision, new revision, compare).