Sort and Reverse Vector
Submissions: 1199   Accuracy:

83.4%

  Difficulty: Basic   Marks: 1
Associated Course(s):   Fork CPP

Now, we are moving towards the good stuff. This module is all about STL vectors and pairs. Vectors are STL containers that you will most frequently use. Think of them as dynamic arrays. They can be dynamically expanded and shrinked. Here we will learn the library functions to sort and reverse a vector.

You are given a vector V of size n. You need to sort it and reverse it.

Input Format:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line contains n denoting the size of the array. The second line contains the space seperated elements of the vector.

Output Format:
For each testcase, in a new line, print the required output.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided functions sortVector() and reverseVector().

Constraints:
1 <= T <= 100
1 <= n <= 107
0 <= Vi <= 107

Examples:
Input:

1
5
1 2 3 4 5
Output:
1 2 3 4 5
5 4 3 2 1

 

** For More Input/Output Examples Use 'Expected Output' option **

Author: Soul_xhacker


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.