# searching medium

How Many Are Less Than X?

Riders shorter than the height limit get the kiddie coaster. 🎢

You get a SORTED list of heights and the limit x. Print how many are strictly less than x — using the boundary trick, not a full count.

Example:

Input: heights = [120, 130, 135, 150, 160], x = 140 Output: 3

The boundary search finds 150 is the first height not smaller than 140, at position 3 — meaning 3 heights come before it, all less than 140.

💡 need a hint?

srch-less-than-x.py🔒 given lines are locked — write your code in between
loading...