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
static int max_sum ( int [ ] a , int n ) { int [ ] dp = new int [ n ] ;