From e2358a2a5279a9cec24c36456cb0f5967cf8ee4b Mon Sep 17 00:00:00 2001 From: Ankit tanwar Date: Sat, 3 Oct 2020 14:21:51 +0530 Subject: [PATCH] added a 2D array 90 degree rotation code --- PrintHelloWorld/HelloWorldMap.java | 13 --------- rotateby90degree.java | 47 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 rotateby90degree.java diff --git a/PrintHelloWorld/HelloWorldMap.java b/PrintHelloWorld/HelloWorldMap.java index f28aa5f..e69de29 100644 --- a/PrintHelloWorld/HelloWorldMap.java +++ b/PrintHelloWorld/HelloWorldMap.java @@ -1,13 +0,0 @@ -import java.util.HashMap; -import java.util.Map; - -public class HelloWorldMap { - public static void main(String[] args) { - Map map = new HashMap<>(); - map.put("helloWorld", "Hello World!"); - - for (String key: map.keySet()) { - System.out.println(map.get(key)); - } - } -} \ No newline at end of file diff --git a/rotateby90degree.java b/rotateby90degree.java new file mode 100644 index 0000000..53467ba --- /dev/null +++ b/rotateby90degree.java @@ -0,0 +1,47 @@ +import java.io.*; +import java.util.*; + +public class Main { + + public static void main(String[] args) throws Exception { + Scanner sc= new Scanner(System.in); + int n=sc.nextInt(); + int arr[][]=new int [n][n]; + for(int i=0;i