For nums = [1,3,5,6] and target = 2, what is returned?

Practice this question from Search Insert Position - Lower bound Pattern Practice Quiz, with options and an explanation.

Question

For nums = [1,3,5,6] and target = 2, what is returned?

Option A

0

Option B — Correct answer

1

Option C

2

Option D

4

Explanation

2 should be inserted before 3, so the returned index is 1.

Search Insert Position - Lower bound Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker