Question: rotate ( arr: StaticArray, steps: int ) - > StaticArray: Write a function that receives two parameters - a StaticArray and an integer value (
rotatearr: StaticArray, steps: int StaticArray:
Write a function that receives two parameters a StaticArray and an integer value called
steps The function will create and return a new StaticArray, which contains all of the
elements from the original array, but their position has shifted right or left steps number of
times. The original array must not be modified.
If steps is a positive integer, the elements will be rotated to the right. If steps is a negative
integer, they will rotate to the left. Please see the code examples below for additional
details. You may assume that the input array will contain at least one element. You do not
need to check for this condition.
Please note that the value of the steps parameter can be very large between and
Your implementation must rotate an array of at least elements in a
reasonable amount of time under a minute
For full credit, the function must be implemented with ON complexity.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
