Update the maximum length of subsequence ending at element is a [ i ] in Dictionary
if ( map . has ( a [ i ] ) ) { map . set ( a [ i ] , Math . max ( map . get ( a [ i ] ) + 1 , dp [ i ] ) ) ; } else { map . set ( a [ i ] , Math . max ( 1 , dp [ i ] ) ) ; } }