← back to unit
Medium
# sorting medium
Find the First Out-of-Order Spot
The domino artist lined up numbered dominoes and something's off — find the first spot where the order breaks. 🁢
You get the nums. Print the position (from 0) of the first number that is BIGGER than its next neighbor, or sorted if the line never breaks.
Example:
Input: nums = [1, 5, 3, 7]
Output: 1
5 > 3 at position 1 — that's the first spot where the order breaks.
💡 need a hint?
sort-first-break.py🔒 given lines are locked — write your code in between
loading...