Soal
00:00

6. Search Insert Position

MudahPencarian binerMicrosoftGoogle

Given a sorted array and a target value, return its index or the index where it would be inserted.

Contoh 1:

Input: nums = [1,3,5,6], target = 5
Output: 2

Contoh 2:

Input: nums = [1,3,5,6], target = 2
Output: 1

Batasan:

  • 1 <= nums.length <= 10^4
Mode kode inti
● Tersimpan otomatisBaris 1, kolom 1