Your question is Rotate Prime Array. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Pcs Research Group needs to reorder a sequence of prime-number identifiers in place while preserving their relative circular order. Given an array containing only prime numbers and a non-negative rotation count, rotate the array to the right by k positions.
A right rotation moves each element to index (i + k) % n. The function must modify the input array in place and return the same array. The fact that every value is prime is an input guarantee, not a condition that requires additional primality checks.
Implement rotate_primes(nums, k):
nums, a mutable list of prime integers, and k, a non-negative integer.nums in place.k is greater than the array length, rotations repeat cyclically.def rotate_primes(nums, k):