From 0d28121916a89c6d890874d0cb9bfc1eedf1cefb Mon Sep 17 00:00:00 2001 From: Jaskirat Singh Date: Sat, 30 Oct 2021 19:50:43 +0530 Subject: [PATCH] Rotate an array Rotate an array problem added --- rotate_array.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 rotate_array.java diff --git a/rotate_array.java b/rotate_array.java new file mode 100644 index 0000000..8b612a7 --- /dev/null +++ b/rotate_array.java @@ -0,0 +1,47 @@ +package functions; +import java.io.*; + +public class rotate_array { + public static void display(int[] a){ + StringBuilder sb = new StringBuilder(); + + for(int val: a){ + sb.append(val + " "); + } + System.out.println(sb); + } + public static void reverse(int[] a, int m, int k){ + for(int i=m;i