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?