LeetCode #3667: Sort Array By Absolute Value
β’ 21 words β’ 1 min
LeetCode #3667: Sort Array By Absolute Value:
class Solution:
def sortByAbsoluteValue(self, nums: List[int]) -> List[int]:
return list(sorted(nums, key=lambda x: abs(x)))
Related Posts
LeetCode #1636: Sort Array by Increasing Frequency:
python from collections import Counter class Solution: def frequencySort(self, nums: List[int]) β¦
Jan 06, 2026
LeetCode #167: Two Sum II β Input Array Is Sorted:
Classic, linear:
python class Solution: def twoSum(self, numbers: List[int], target: int) -> β¦
Jan 06, 2026
Previously, previously, previously, previously.
Thiago Perrotta