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.
I am using same approach, but i have answer is 2, for case A ->B -> C Cost (A,B)->1 (B,C) ->2 and (A,B) ->2, but tests cases 5,8, 10 - 13, is wrong answer. Where is error?
Minimum Penalty Path
You are viewing a single comment's thread. Return to all comments →
Consider this
A ->B -> C Cost (A,B)->1 (B,C) ->2 and (A,B) ->2 (Multiple edges can exist)
In this case your approach from A to C will give 3. But the answer is 2.
Thanks! I undestood the error.
I am using same approach, but i have answer is 2, for case A ->B -> C Cost (A,B)->1 (B,C) ->2 and (A,B) ->2, but tests cases 5,8, 10 - 13, is wrong answer. Where is error?
Same for me. Did you find the reason?
No, I can't find it.
fionalmatters explained why Djikstra won't work:
https://www.hackerrank.com/challenges/beautiful-path/forum/comments/137106
Nice!!
so, there's no way to do it with djikstra?
I think yes
Thanks!!!!!!