Sort me this way !
Tag(s):

## Ad-Hoc, Algorithms, Data Structures, Easy, Sorting, approved

Problem
Editorial
Analytics

Given an array A consisting of integers of size N, you need to sort this array in non-decreasing order on the basis of the absolute value of the integers in the array. Print the sorted array to output then.

Input:

The first line consists of a single integer N, the number of elements in the array. The next line consists of N space separated elements. No two elements in the array will have same absolute value.

Output:

You need to print the absolute sorted array. See the sample output for clarification.

Constraints:

$1 \le N \le 10^5$

$-10^9 \le A[i] \le 10^9$ A[i] is the $i^{th}$ element of the array.

SAMPLE INPUT
10
9 -10 -11 20 1 2 -3 4 -5 6

SAMPLE OUTPUT
1 2 -3 4 -5 6 9 -10 -11 20

Explanation

The output array is sorted by absolute values.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

ION Core Java Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
• Algorithms > Searching