I've just started with dfs shortes path problems and i'm really gettig confused while using memoization techniques to decrease the time complexity

Please check these two problems

  1. https://leetcode.com/problems/path-with-minimum-effort/
    I've seen solutions where people used memoization techniques with array memo, where memo[i] is max/min value from source to i say 0 to i

and in this case

  1. https://leetcode.com/problems/path-with-maximum-probability/

I've seen solutions where people used memoization techniques with array memo, where memo[i] is max/min value from i to end say i to n-1

so my general doubt is that when to memoize from start to i and when from i to end

im really confused now, as to use which one? Can someone please help with this.

Comments (0)