← ALL NOTES
Array

35. Search Insert Position

The answer is the position of the first element >= target — that's lower_bound, and it covers both cases at once: if target is present, that position is its index; if it isn't, it's where you'd slot…

Loading…