Skip to content

Commit

Permalink
add Array Left Rotation - Data Structures
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas98320 committed Jul 5, 2016
1 parent d85d785 commit 6e3353b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Data Structures/Array Left Rotation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.io.*;
import java.util.*;

public class Solution {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int size = in.nextInt();
int n = in.nextInt();
int[] arr = new int[size];

for(int i = 0; i < size; i++) {
if(n > i)
arr[size - n + i] = in.nextInt();
else
arr[i - n] = in.nextInt();
}

for(int i = 0; i < size; i++)
System.out.print(arr[i] + " ");
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Say "Hello, World!" With C++<br>

<h3>Data Structures</h3>
2D Array - DS<br>
Array Left Rotation<br>
Arrays - DS<br>
Print the Elements of a Linked List<br>

Expand Down

0 comments on commit 6e3353b

Please sign in to comment.