iterative code running slower than recursive. Why ?

Revision en1, by unt311, 2021-09-05 14:16:14

I tried solving problem magic numbers with iterative digit dp. But it runs slower than my recursive solution by more than 200ms.

iterative : link

recursive : link

I also avoided using modulo operations in my iterative code, but am surprised to see it running slower.

Any idea why this happened?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English unt311 2021-09-05 14:16:14 531 Initial revision (published)