Maximum limit upto which we can place digit . If tight is false , means number has already become smaller so we can place any digit , otherwise N [ pos ]
int upper_limit = ( tight ) ? ( N [ pos ] - '0' ) : 9 ; int new_tight ;