title: Maximum Sum Subsequence Least K Distant Elements
signature: maximumSumSubsequenceLeastKDistantElements(arr, n, k) {
source_py: def maximum_sum_subsequence_least_k_distant_elements(arr, N, k):
      MS = [0 for i in range(N)]
      MS[(N - 1)] = arr[(N - 1)]
      for i in range((N - 2), (- 1), (- 1)):
          if (((i + k) + 1) >= N):
              MS[i] = max(arr[i], MS[(i + 1)])
          else:
              MS[i] = max((arr[i] + MS[((i + k) + 1)]), MS[(i + 1)])
      return MS[0]
source_cpp: int maximum_sum_subsequence_least_k_distant_elements(vector<int> arr, int N, int k) {
    int MS [ N ];
    MS [ N - 1 ] = arr [ N - 1 ];
    for ( int i = N - 2;
    i >= 0;
    i -- ) {
      if ( i + k + 1 >= N ) MS [ i ] = max ( arr [ i ], MS [ i + 1 ] );
      else MS [ i ] = max ( arr [ i ] + MS [ i + k + 1 ], MS [ i + 1 ] );
    }
    return MS [ 0 ];
  }