β back to unit
Challenge
# searching advanced
Find the Smallest Number At Least X
You need the cheapest gift that still costs at least x β gift cards below the minimum look stingy! π
You get a SORTED list of prices and the minimum x. Print the smallest price that is x or more, or none if every price is too small.
Example:
Input: prices = [5, 15, 25, 40], x = 18
Output: 25
The boundary search finds the first price that's 18 or more, which is 25.
π‘ need a hint?
srch-ceiling.pyπ given lines are locked β write your code in between
loading...