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 Djikstra from the source vertex and at each step instead of adding the current distance of a node to the edge weight joining it to another I am taking bitwise OR. Then I am printing minimum distance so obtained to point B. Test cases 0-4 and 6-9 are working, rest say wrong answer. Can Someone suggest a mistake in the approach?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Penalty Path
You are viewing a single comment's thread. Return to all comments →
I am using Djikstra from the source vertex and at each step instead of adding the current distance of a node to the edge weight joining it to another I am taking bitwise OR. Then I am printing minimum distance so obtained to point B. Test cases 0-4 and 6-9 are working, rest say wrong answer. Can Someone suggest a mistake in the approach?