If the last digit of dequeued integer is not 9 , then enqueue the next such number .
if ( arr [ i ] % 10 != 9 ) q . push ( arr [ i ] * 10 + arr [ i ] % 10 + 1 ) ; } document . write ( arr [ N ] + " " ) ; }