If a [ i ] % a [ j ] then update the maximum subsequence length , dp [ i ] = Math . max ( dp [ i ] , 1 + dp [ j ] ) where j is in the range [ 0 , i - 1 ]
dp [ i ] = Math . max ( dp [ i ] , 1 + dp [ j ] ) ; } } res = Math . max ( res , dp [ i ] ) ; }