Function to return the maximum sum of the sub - sequence such that two consecutive elements have a difference of at least 3 in their indices in the given array
function max_sum ( a , n ) { let dp = new Array ( n ) ;