Dsa
Arrays
Medium
Reorder with Interval
You are given an array of integers and a positive integer k. Rearrange the array such that every k-th element is in descending order while the rest remain in their original order. The input consists of a single line with integers separated by spaces followed by a single integer k. Print the modified array as space-separated integers.
Example Input:
1 3 5 2 4 6 7 8 9
3
Example Output:
1 3 5 9 4 6 7 8 2
Key concepts
arrayssortingintervals
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now