Driver code
public static void main ( String [ ] args ) { Integer arr [ ] = { 12 , 2 , 8 , 6 , 3 , 1 , 9 } ; N = arr . length ; MAX = Collections . max ( Arrays . asList ( arr ) ) ; preCompute ( ) ; System . out . println ( maxLengthSubsequence ( arr , N - 1 ) ) ; } }