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 (used global variables) (https://atcoder.jp/contests/dp/submissions/24396078)↵
↵
↵
↵
Just adding some more parameters to a function completely changed the time complexity, strange isn't it?
↵
↵
↵
↵
↵
↵
My First solution which took more than 2000ms (https://atcoder.jp/contests/dp/submissions/24396061)↵
↵
↵
↵
My Second solution which took less than 200ms (used global variables) (https://atcoder.jp/contests/dp/submissions/24396078)↵
↵
↵
↵
Just adding some more parameters to a function completely changed the time complexity, strange isn't it?