Multi-key sort

Write codeMedium20 min

Your task

Implement ORDER BY age ASC, salary DESC, name ASC for a query result. Given rows as [name, age, salary] (name string, age and salary integers), return the rows sorted by age ascending, then by salary descending, then by name ascending as a final stable tie-break. Return the full rows in sorted order. Up to 10000 rows.

Examples

order_by_multi(rows: list[list]) -> list[list]
Example 1
Inputorder_by_multi([["ann", 30, 100], ["bob", 30, 200], ["cy", 25, 50]])
Output[["cy", 25, 50], ["bob", 30, 200], ["ann", 30, 100]]