Maximum sum of pairs that are at least K distance apart in an array
Given an array arr[] consisting of N integers and an integer K, the task is to find the maximum sum of pairs of elements that are separated by at least K indices. Examples: Input: arr[] = {2, 4, 1, 6, 8}, K = 2Output: 12Explanation:The elements {1, 4} are K(= 2) distance apart. The sum of pairs {4,