You are given an integer array nums that represents a circular array.
Create a new array result of the same length, where for each index i:
If nums[i] nums[i] steps to the right and set result[i] to the value at the arrival index.
If nums[i] nums[i]result[i] to the value at the arrival index.
If nums[i] result[i] to nums[i].
Return the resulting array result.
Note: A circular array wraps around continuously, meaning moving forward past the last element cycles back to the first element, and moving backward past the first element cycles to the last element.
Constraints:
nums.length
nums[i]
You are given an integer array nums that represents a circular array.
Create a new array result of the same length, where for each index i:
If nums[i] nums[i] steps to the right and set result[i] to the value at the arrival index.
If nums[i] nums[i]result[i] to the value at the arrival index.
If nums[i] result[i] to nums[i].
Return the resulting array result.
Note: A circular array wraps around continuously, meaning moving forward past the last element cycles back to the first element, and moving backward past the first element cycles to the last element.
Constraints:
nums.length
nums[i]