ADIGIT-Time limit Exceeded

I am getting time limited exceeded for this question.Can somebody can help me and tell at which point I am doing anything which is not necessary.
Only hint will also help me to think my mistake
http://www.codechef.com/viewsolution/4123176

u’ll need a smarter approach…u are travelling the array exhaustively which is not required…think & optimise yr logic…

1 Like