data_structures.arrays.rotate_array =================================== .. py:module:: data_structures.arrays.rotate_array Attributes ---------- .. autoapisummary:: data_structures.arrays.rotate_array.examples Functions --------- .. autoapisummary:: data_structures.arrays.rotate_array.rotate_array Module Contents --------------- .. py:function:: rotate_array(arr: list[int], steps: int) -> list[int] Rotates a list to the right by steps positions. Parameters: arr (List[int]): The list of integers to rotate. steps (int): Number of positions to rotate. Can be negative for left rotation. Returns: List[int]: Rotated list. Examples: >>> rotate_array([1, 2, 3, 4, 5], 2) [4, 5, 1, 2, 3] >>> rotate_array([1, 2, 3, 4, 5], -2) [3, 4, 5, 1, 2] >>> rotate_array([1, 2, 3, 4, 5], 7) [4, 5, 1, 2, 3] >>> rotate_array([], 3) [] .. py:data:: examples