Skip to content

Commit e093752

Browse files
committed
feat: Perform left rotation on array by one position
🧠 Logic: - Print the original array. - Store the first element in a temporary variable. - Shift all elements one position to the left. - Assign the stored first element to the last index of the array. - Print the updated array after rotation. Signed-off-by: Somesh diwan <[email protected]>
1 parent 3e857c3 commit e093752

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Section9ArrayAB/Array IMP/RotateArrayIMP.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static void main(String[] args) {
1313
for(int i=1; i<A.length; i++) {
1414
A[i-1]=A[i];
1515
}
16+
1617
A[A.length-1]=temp;
1718

1819
for (int x:A)

0 commit comments

Comments
 (0)