### NafisAlam's blog

By NafisAlam, 7 weeks ago,

Can someone help me understand the time complexity of submission #1 and #2? I don't understand why I got TLE on submission #1.

TLE submission #1 : 191420410

TLE submission #2 : 191295823

• -3

 » 7 weeks ago, # | ← Rev. 2 →   +5  cin >> a[i]; if(a[i] % 2 == 1) a[i] += a[i] % 10; while(a[i] < 10) a[i] += a[i] % 10; This code will enter an infinite loop when the input is 0.This is correct:  cin >> a[i]; if(a[i] % 2 == 1) a[i] += a[i] % 10; while(a[i] < 10 && a[i] != 0) a[i] += a[i] % 10; 
•  » » 7 weeks ago, # ^ |   0 Thank you so much, I didn't realize the constraints were between [0,1e9].