Minimize the number of strictly increasing subsequences in an array | Set 2 | Function to find the number of strictly increasing subsequences in an array ; Sort the array ; Stores readonly count of subsequences ; Traverse the array ; Stores current element ; Stores frequency of the current element ; Count frequency of the current element ; If current element frequency is greater than count ; Print the readonly count ; Given array ; Size of the array ; Function call to find the number of strictly increasing subsequences
function minimumIncreasingSubsequences ( arr , N ) { arr . sort ( function ( a , b ) { return a - b } ) ; let count = 0 ; let i = 0 ; while ( i < N ) { let x = arr [ i ] ; let freqX = 0 ; while ( i < N && arr [ i ] == x ) { freqX ++ ; i ++ ; } count = Math . max ( count , freqX ) ; } document . write ( count ) ; } let arr = [ 2 , 1 , 2 , 1 , 4 , 3 ] ; let N = arr . length ; minimumIncreasingSubsequences ( arr , N ) ;