thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

LeetCode #3667: Sort Array By Absolute Value

β€’ 21 words β€’ 1 min

LeetCode #3667: Sort Array By Absolute Value:

python
class Solution:
    def sortByAbsoluteValue(self, nums: List[int]) -> List[int]:
        return list(sorted(nums, key=lambda x: abs(x)))