← back to unit
Medium
# sorting medium
Is It a Mountain?
A proper mountain climbs, hits one peak, then descends — no flat parts, no double peaks. ⛰️
You get at least 3 nums. Print mountain if they strictly rise then strictly fall (with the peak somewhere in the middle), otherwise not a mountain.
Example:
Input: nums = [1, 4, 7, 5, 2]
Output: mountain
It strictly climbs 1 → 4 → 7, peaks at 7, then strictly falls 7 → 5 → 2 — a real mountain.
💡 need a hint?
sort-is-mountain.py🔒 given lines are locked — write your code in between
loading...