X must be place at the last index where is greater than N [ i ]
for ( let i = len - 1 ; i >= 1 ; i -- ) { if ( ( N [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) < X ) { position = i ; } } } else {