Lexicographically smallest subsequence possible by removing a character from given string | Function to find the lexicographically smallest subsequence of length N - 1 ; Generate all subsequence of length N - 1 ; Store main value of String str ; Sort the vector ; Print first element of vector ; Given String S ; Function Call
function firstSubsequence ( s ) { let allsubseq = [ ] ; for ( let i = 0 ; i < s . length ; i ++ ) { let k = " " ; for ( let j = 0 ; j < s . length ; j ++ ) { if ( i != j ) { k += s [ j ] ; } } allsubseq . push ( k ) ; } ( allsubseq ) . sort ( ) ; document . write ( allsubseq [ 0 ] ) ; } let S = " " ; firstSubsequence ( S ) ;