Left Rotate Array by One

Logic Building: Rotations & Sets DSA practice problem on Onlearn.

Difficulty: easy.

Topics: Left Rotate an Array by One Place, Arrays, Time Complexity, Space Complexity, space complexity, time complexity analysis, array manipulation, Array Rotation, In-Place Algorithms.

Problem Statement: Given an array of N integers, left rotate the array by one place. Input: The first line contains an integer N, the size of the array. The second line contains N integers, representing the elements of the array. Output: Output the array after performing a left rotation by one place, with elements separated by spaces. Example 1: Input: 5 1 2 3 4 5 Output: 2 3 4 5 1 Explanation: Since all the elements in the array will be shifted toward the left by one, '2' will now become the first element and '1' which was present at the first index will be shifted to the last. Example 2: Input: 1 3 Output: 3 Explanation: Here only one element is present, so the element at the first index will be shifted to the last index which is also the first index.