Why such vast execution-time difference in the two solutions?

Revision en3, by Kmare, 2021-07-19 22:55:14

I was solving "Digit sum" problem of Atcoder DP contest. I am just curious why my two solutions have such a vast difference in their execution time.  My First solution which took more than 2000ms (https://atcoder.jp/contests/dp/submissions/24396061)  My Second solution which took less than 200ms (https://atcoder.jp/contests/dp/submissions/24396078)  Just adding some more parameters to a function completely changed the time complexity, strange isn't it?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English Kmare 2021-07-19 22:57:23 0 (published)
en6 English Kmare 2021-07-19 22:56:59 24 Tiny change: 'an 200ms (https://' -> 'an 200ms (used global variables) (https://'
en5 English Kmare 2021-07-19 22:56:09 6 Tiny change: 'on time.\n![ ](/pr' -> 'on time.\n\n\n\n![ ](/pr'
en4 English Kmare 2021-07-19 22:55:52 12
en3 English Kmare 2021-07-19 22:55:14 270
en2 English Kmare 2021-07-19 22:53:14 95
en1 English Kmare 2021-07-19 22:52:22 689 Initial revision (saved to drafts)