← back to unit
Medium
# sorting medium
Who's Cutting the Line?
The queue is supposed to go shortest to tallest — a line-cutter is someone TALLER than the person right behind them. 😤
You get the heights in line order. Print the height of the FIRST line-cutter, or no cutters if the line is fair.
Example:
Input: heights = [110, 125, 160, 130, 140]
Output: 160
160 is taller than the person right behind them (130), making 160 the first line-cutter.
💡 need a hint?
sort-line-cutter.py🔒 given lines are locked — write your code in between
loading...