Search
⌘K

Leetcode 2724. Sort By

Given an array and a function fn that maps each element to a unique numeric key, return the array sorted in ascending order by fn(element). Expect up to 5e5 elements, so use an efficient sort with a custom comparator based on fn.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.