Click here to see the full article post
memo[ind][jumpsize] = ((ind == stones.length - 1) ? 1 : 0);
Properly using parentheses makes expressions clear, but the outer parentheses in this statement look a bit over-conservative.
In the animation for approach #5, there are two valid steps from which we can go to either 4th or 5th position.
The second step (3+3=6) is missing in the animation.
This is not correct. You have an inner set. If there are n^2 states your inserting will be nnlg(nn) = nnlg(n) != nn. The analysis on why it's n*n "Two nested loops are there" is very weak. The first loops n times but how many times does the second loop? It's not n. It's at most n because otherwise you'd have reached the goal.
If it's not O(n2), then what's your time-complexity analysis?
Approach #4 is misleading. Why using binary search which costs log(n) for searching instead of HashSet? Using HashSet, we just need build it once and can search for each element in an average of O(1) time.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.