arr [ i ] wants to be a potential condidate of future subsequence It will replace ceil value in tailIndices
let pos = GetCeilIndex ( arr , tailIndices , - 1 , len - 1 , arr [ i ] ) ; prevIndices [ i ] = tailIndices [ pos - 1 ] ; tailIndices [ pos ] = i ; } } document . write ( " " + " " ) ; for ( let i = tailIndices [ len - 1 ] ; i >= 0 ; i = prevIndices [ i ] ) document . write ( arr [ i ] + " " ) ; document . write ( " " ) ; return len ; }