Tap here to switch tabs
Problem
Submissions

Problem: Sort Array By Absolute Value

Sort Array By Absolute Value asks you to reorder an integer array by each number's absolute value and return it in nondecreasing order, even when values are negative.

Statement

Given an integer array nums, sort the array in non decreasing order based on the absolute value of each element.

Return the sorted array.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • −100≤-100 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort Array By Absolute Value

Sort Array By Absolute Value asks you to reorder an integer array by each number's absolute value and return it in nondecreasing order, even when values are negative.

Statement

Given an integer array nums, sort the array in non decreasing order based on the absolute value of each element.

Return the sorted array.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • −100≤-100 \leq nums[i] ≤100\leq 100