easyArraySimulation 0 views

Transformed Array

You are given an integer array nums that represents a circular array.

You are given an integer array nums that represents a circular array. Your task is to create a new array result of the same size, following these rules:

Return the new array result.

Note: Since nums is circular, moving past the last element wraps around to the beginning, and moving before the first element wraps back to the end.

Transformed Array diagram

Example 1

Input: nums = [3,-2,1,1]

Output: [1,1,1,3]

Example 2

Input: nums = [-1,4,-1]

Output: [-1,-1,4]

Constraints

  • 1 <= nums.length <= 100
  • -100 <= nums[i] <= 100

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.