← back to unit
Medium
# sorting medium
The Lazy Sorter
Why sort a shelf that's already sorted? Check first, sweat later. 🦥
You get a list of nums. If it's already in order, print already tidy. Otherwise sort it (your choice how) and print it comma-separated.
Example:
Input: nums = [1, 2, 2, 9]
Output: already tidy
Checking first shows the list is already in order, so no sorting work is needed.
💡 need a hint?
sort-lazy-sorter.py🔒 given lines are locked — write your code in between
loading...