Input: arr[] = {1, 2, 3, 4, 5, 6, 7, 8}, K = 2
Output: 1 2 4 5 7
Explanation:
Initially, the array arr[] is {1, 2, 3, 4, 5, 6, 7, 8}.
Operation 1: Delete every (A[1] + A[2])th element, i.e., every 3rd element from the array arr[]. Now the array modifies to {1, 2, 4, 5, 7, 8}.
Operation 2: Delete every (A[2] + A[3])th element, i.e., every 6th element from the array arr[]. Now the array modifies to {1, 2, 4, 5, 7}.
After performing the above operations, the array obtained is {1, 2, 4, 5, 7}.
Input: N = 10, K = 3
Output: 1 2 4 5 7 10