← back to unit
Medium
# sorting medium
The Stubborn Last One
The line was PERFECT until one latecomer stomped to the end of it. 😾
You get a list of nums where everything is sorted except possibly the last value. Move that last value to its correct spot (shifting others right) and print the list, comma-separated.
Example:
Input: nums = [2, 5, 8, 11, 6]
Output: 2,5,6,8,11
The latecomer 6 shifts past 11 and 8 (both bigger than it), landing right after 5.
💡 need a hint?
sort-stubborn-last-one.py🔒 given lines are locked — write your code in between
loading...