Day 7: Arrays In Java | 30 Days Of Code | Hackerrank Programming Solutions

Hello Programmers/Coders, Today we are going to share solutions of Programming problems of 30 Days Of Code, HackerRank. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.

In this post, you will find the solution for Day 7: Arrays in Java-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.

Link for the ProblemDay 7: Arrays – Hacker Rank Solution

Day 7: Arrays – Hacker Rank Solution


Today, we will learn about the Array data structure. Check out the Tutorial tab for learning materials and an instructional video.

Given an array, , of  integers, print ‘s elements in reverse order as a single line of space-separated numbers.


Print 4 3 2 1. Each integer is separated by one space.

Input Format

The first line contains an integer,  (the size of our array).
The second line contains  space-separated integers that describe array ‘s elements.



  • , where  is the  integer in the array.

Output Format

Print the elements of array  in reverse order as a single line of space-separated numbers.

Sample Input

1 4 3 2

Sample Output

2 3 4 1
Day 7: Arrays – Hacker Rank Solution
import java.util.Scanner;

 * @author Techno-RJ
public class Day7Arrays {
	public static void main(String[] args) {
		Scanner in = new Scanner(;
		int n = in.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		for (int i = n - 1; i >= 0; i--) {

			System.out.print(arr[i] + " ");

Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker🙏.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock