https://medium.com/@johnmilimowanjala/solving-the-path-problem-using-dynamic-programming-approach-fe1c1c43295d