Question: Python A StaticArray is a very simple class that simulates the behavior of a fixed size array. It has only four methods, that allow you
Python
A StaticArray is a very simple class that simulates the behavior of a fixed size array. It has only four methods, that allow you to: 1)Create a new static array that will store a fixed number of elements. Once the StaticArray is created, its size can not be changed. 2)Change the value of any element using its index 3)Read the value of any element using its index 4)Query the size of the array.
Question:
def rotate(arr: StaticArray, steps: int) -> StaticArray:
""" Return a new StaticArray where all elements are from the original array, but their position has shifted right or left steps number of times. If steps is a positive integer, elements should be rotated right. If its negative, rotation is to the left
"""
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
