package
0.0.0-20241209194135-874399dce24d
Repository: https://github.com/snipersap/goprojects.git
Documentation: pkg.go.dev
# README
Hackerrank challenge Day 7: Arrays
Objective
Today, we will learn about the Array data structure. Check out the Tutorial tab for learning materials and an instructional video.
Biggest challenge
The challenge was not in printing the array in reverse but getting a space separated line and converting it from slice of string to integer array.
Task
Given an array, A, of N integers, print A's elements in reverse order as a single line of space-separated numbers.
Example
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.
Constraints
1 <= N <= 10000
1 <= A[i] <= 10000, where A[i] is the i<sup>th</sup> 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
4
1 4 3 2
Sample Output
2 3 4 1
Test Result
Enter the size of the integer array:
4
Enter the space separated list of integers:1 2 3 4 5 6
The integer array printed in reverse (upto max size given) is:
4 3 2 1