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.
2 days struggling and I finally passed all test with Dijkstra's algo, slowest TC at 6.35 secs with Python. After runtime errors I thought about using Dijkstra without creating a dictionary graph (we already know all edges, [i][j]->[i][j+1], ...) and tried to put all solution inside Dijkstra. But after spending hours to fix it I looked for similar implementations on net and found some nice simple ways to do it. (it became 5 times faster than Dijkstra with dict graph but still 4 times slower than DP solution)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #82: Path sum: three ways
You are viewing a single comment's thread. Return to all comments →
2 days struggling and I finally passed all test with Dijkstra's algo, slowest TC at 6.35 secs with Python. After runtime errors I thought about using Dijkstra without creating a dictionary graph (we already know all edges, [i][j]->[i][j+1], ...) and tried to put all solution inside Dijkstra. But after spending hours to fix it I looked for similar implementations on net and found some nice simple ways to do it. (it became 5 times faster than Dijkstra with dict graph but still 4 times slower than DP solution)