nums is sorted in non-decreasing order and may contain repeated values. Return the first index i with nums[i] >= target. If every value is smaller than target, return len(nums).
This is where target would be inserted to keep the list sorted, before any equal values.
Example 1
Input:
lower_bound([1, 2, 2, 2, 5], 2)
Output:
1
The first 2 is at index 1.
Example 2
Input:
lower_bound([1, 3, 5], 6)
Output:
3
Every value is smaller than 6, so the answer is the length, 3.
0 <= len(nums) <= 2 * 10**5nums is sorted in non-decreasing order.-10**9 <= nums[i], target <= 10**9in, .index, .count, min or sorted on the whole list, fails them.No results yet
Run your code to check it against the examples, or submit to run every test.