iterative code running slower than recursive. Why ?

Правка en1, от 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?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский unt311 2021-09-05 14:16:14 531 Initial revision (published)