If digit > K is present previously and current digit is less than K
if ( count == 0 and digit < k ) : NEW_LINE INDENT ans . insert ( 0 , digit + 1 ) NEW_LINE changed = True NEW_LINE DEDENT else : NEW_LINE INDENT ans . insert ( 0 , 1 ) NEW_LINE DEDENT