learn kro favicon img

Day 7: Arrays | HackerRank Solution

Hello coders, today we are going to solve Day 7: Arrays HackerRank Solution in C++Java and Python.


Today, we will learn about the Array data structure.


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


A = [1 ,2, 3, 4]

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

Input Format

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


  • 1 <= N <= 1000
  • 1 <= A[i] <= 10000, where A[iis the ith integer in the array.

Output Format

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

Sample Input

Sample Output

Solution – Day 7: Arrays




print (*arr[::-1], sep=’ ‘)

Disclaimer: The above Problem (Day 7: Arrays) is generated by Hacker Rank but the Solution is Provided by Learnkro. This tutorial is only for Educational and Learning Purpose.

Leave a Comment

Your email address will not be published. Required fields are marked *