Memoization and RE

Revision en3, by Codeforcer, 2021-05-25 11:46:18

I was solving this : https://leetcode.com/problems/minimum-jumps-to-reach-home/ and wrote essentially 2 same solutions, just the way of calculating transitions is a bit different. I get AC in one and RE in the second. I am not getting the reason for such a difference in results. So please help me understand.

One which gives RE
One which gives AC
The difference

As you can see logically both are correct then why the difference ?

Thanks!

Tags memoization, dp, help, re

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Codeforcer 2021-05-25 11:46:18 2 Tiny change: ' I do this.\n ' -> ' I do this\n '
en2 English Codeforcer 2021-05-25 11:31:24 70
en1 English Codeforcer 2021-05-25 11:24:47 2704 (published)