Initialize the dp values till k since any two elements included in the sub - sequence must be atleast k indices apart , and thus first element and second element will be k indices apart
for i in range ( 1 , k + 1 ) : NEW_LINE INDENT dp [ i ] = max ( arr [ i ] , dp [ i - 1 ] ) ; NEW_LINE DEDENT