-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReverseArr.java
46 lines (46 loc) · 1.27 KB
/
ReverseArr.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//import java.util.Scanner;
//
//public class ReverseArr {
//
// int [] reverse(int [] A){
// int rev=0;
// while(A[rev]!=0){
//rev++;
// }
// int [] B=new int[rev];
// for(int i = 0; i<rev;i++){
// B[i]=A[i];
// }
// for(int i = 0; i<rev;i++){
// A[i]=B[rev-i-1];
// }
// return A;
// }
//// rev=rev*10+r;
//// n=n/10;
//// }
//// return rev;
//// }
// int [] reverse(int [] A){
// int [] A=new int[arr.length];
// for(int i = arr.length-1, j = 0;i>=0;i--,j++){
// A[j]=arr[i];
// }
// return A;
// }
//
// public static void main(String[] args) {
// int[] arr = {45,23,343,432,551,673,721,863,923,214};
//ReverseArr ra = new ReverseArr();
// int [] reversArr = ra.reverse(n);
// for(int i = 0; i<A.length;i++){
// System.out.println("");
// System.out.print(A[i]);
// }
//// Scanner sc = new Scanner(System.in);
//// System.out.println("Enter the number to reverse: ");
//// int n = sc.nextInt();
//// int r = ra.reverse(n);
//// System.out.println("Reverse of "+n+" is "+r);
// }
//}