What does Search Insert Position return when the target is absent?
Practice this question from Search Insert Position - Lower bound Pattern Practice Quiz, with options and an explanation.
Question
What does Search Insert Position return when the target is absent?
Option A — Correct answer
The first sorted insertion index
Option B
Always -1
Option C
The last index only
Option D
The target value itself
Explanation
It returns the index where the target should be inserted to keep the array sorted.