01 Aug PMCA Sunday 12:00 Java Homework 20.07.26.
Posted at 00:33h in Sunday 12:00 Java Homework 0 Comments
Write code to do absolute sort with the following condition
- Sort an array according to its absolute value. Please refer to this link https://en.wikipedia.org/wiki/Absolute_value if you don’t know what absolute value is
- If the array for a specific number contains both its negative form and the positive form, the sorting algorithm should put the negative form of the number before the positive form
Input [1,2,3 -2, 0 , -1, -2, 4] Output [ 0, -1, 1, -2, -2, 2, 3, 4]
Sorry, the comment form is closed at this time.