We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 191b634 + 4db2022 commit 2759f2eCopy full SHA for 2759f2e
1 file changed
left rotation
@@ -0,0 +1,37 @@
1
+#https://www.facebook.com/permalink.php?story_fbid=103039851600105&id=100056822710327
2
+#Subscribed by Sonali Gupta
3
+
4
+import java.io.*;
5
+import java.util.*;
6
+import java.text.*;
7
+import java.math.*;
8
+import java.util.regex.*;
9
10
+public class Solution {
11
+ public static void main(String[] args) {
12
+ Scanner in =new Scanner(System.in);
13
+ int n = in.nextInt();
14
+ int d = in.nextInt();
15
+ int[] arr=new int[n];
16
17
+ int i, temp, j;
18
19
+ for(i=0;i<n;i++)
20
+ arr[i]=in.nextInt();
21
22
+ for (i = 0; i < d; i++)
23
+ {
24
+ temp = arr[0];
25
+ for(j = 1; j <= n-1; j++)
26
27
+ arr[j-1] = arr[j];
28
+ }
29
+ arr[n-1] = temp;
30
31
32
+ for(i = 0; i < n; i++)
33
34
+ System.out.print(arr[i]+" ");
35
36
37
+}
0 commit comments