# Frog Jump

• Nice work! One check - it should be 'memoization' instead of 'memorization'.

• 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.
http://introcs.cs.princeton.edu/java/11precedence/

• Edited, thanks! :)

• Can someone explain why approach 3 is O(n^3)?

• In the animation for approach #5, there are two valid steps from which we can go to either 4th or 5th position.
3+2 =5
3+3 =6
The second step (3+3=6) is missing in the animation.

• Edited, Thanks.

• 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.

• @miguel14

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.

• Seems the time complexity analysis here is quite suspicious, for approach #3, time complexity is O(n^2) to me, how can you get a O(n^3) when you fill in a 2-D memo matrix?

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.