Negative numbers in test case


The test cases have negative numbers in the grid while the statement clearly mentioned non-negative numbers.


yeah, test cases have negative numbers while its mentioned non negative numbers in the question description.


Although its bad of Interview-bit to put negative numbers in a test case, I believe the fact that it belongs to dp section (and not to greedy section) lights a bulb in my mind. Which essentially says, we need to use bellman ford algorithm and not the Dijkstra’s.
You can imagine matrix as a graph with nodes represented by co-ordinate and edge cost represented by the value at that co-ordinate point.


Statement doesn’t have that note anymore, so this issue is no longer valid.