Ad
  • Default User Avatar

    I had change one's mind problem using the dynamic programming method, all tests passes except the very big square, with what it can be connected?

  • Custom User Avatar

    The problem with this approach is that you're calculating the cost of every possible path in the matrix. As you can imagine, that is quite a lot of possibilities. There is a much smarter way solve this problem, that gives you a running time of O(n^2) if the matrix is quadratic (Hint: Dynamic programming).

  • Default User Avatar

    I have the same problem and i think my code is efficient because i use recursion to go trough all possible paths and storing the total sum in a list, at the end i return the smallest element of the list. Does it still have to be more efficient? Or is it probaby because i use a global list to solve the problem? (i'll put the code as a reply to this msg marked as spoiler)

  • Custom User Avatar

    The tests have been made in a way that requires you to come up with an implementation that runs pretty fast. (Hint: dynamic programming)

  • Default User Avatar

    Solved this problem, using recursion, my computer thinks everything is fine, and in tests does not pass due to the delay more than 12 seconds, help you how to send a decision?