← back to unit
Medium
# searching medium
Search Between Two Points
The metal detector only sweeps part of the beach today. 🏖️
You get a list of nums (what's buried at each spot), a target, and two positions lo and hi. Search ONLY the spots from lo to hi (both included). Print the first position holding the target, or none.
Example:
Input: nums = [7, 3, 9, 3, 5], target = 3, lo = 2, hi = 4
Output: 3
Only positions 2 through 4 (values 9, 3, 5) are swept. The first 3 inside that window sits at position 3.
💡 need a hint?
srch-between-two-points.py🔒 given lines are locked — write your code in between
loading...