# searching medium

Find Where It Would Go

A new student joins the height-ordered class photo β€” where should they stand? πŸ“Έ

You get a SORTED list of nums and a new value. Print the position where it belongs: the first spot whose value is at least as big (or the position past the end if it's the biggest).

Example:

Input: nums = [10, 20, 30, 40], new = 25 Output: 2

25 belongs between 20 (position 1) and 30 (position 2) β€” the boundary search lands on position 2, the first spot whose value isn't smaller than 25.

πŸ’‘ need a hint?

srch-insertion-point.pyπŸ”’ given lines are locked β€” write your code in between
loading...