data-structures · intermediate · ~15 min
Index arithmetic with modular shifts.
Implement void rotate_right(int *a, size_t n, size_t k) that rotates a right by k positions (k may exceed n).
#include <stddef.h>
void rotate_right(int *a, size_t n, size_t k) { /* TODO */ }
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.