← back to unit
Medium
# searching medium
Tallest Tree, and Its Spot
The park ranger maps every tree along the trail. 🌲
You get a list of tree heights (at least one). Print the tallest height AND its position (from 0), separated by a space. If two trees tie, report the first one.
Example:
Input: heights = [12, 30, 7, 30, 25]
Output: 30 1
The tallest height is 30. Using strict > keeps the FIRST 30 (position 1) instead of letting the second 30 at position 3 steal the spot.
💡 need a hint?
srch-tallest-tree-spot.py🔒 given lines are locked — write your code in between
loading...