python-algorithm
leetcode 1636. Sort Array by Increasing Frequency
무적김두칠
2024. 1. 9. 22:34
https://leetcode.com/problems/sort-array-by-increasing-frequency/description/
Sort Array by Increasing Frequency - LeetCode
Can you solve this real interview question? Sort Array by Increasing Frequency - Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing o
leetcode.com
1 2 3 | class Solution: def frequencySort(self, nums: List[int]) -> List[int]: return sorted(nums, key = lambda x : (nums.count(x), -x)) | cs |
반응형