प्रश्न
00:00

6. Search Insert Position

आसानबाइनरी सर्चMicrosoftGoogle

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

उदाहरण 1:

इनपुट: nums = [1,3,5,6], target = 5
आउटपुट: 2

उदाहरण 2:

इनपुट: nums = [1,3,5,6], target = 2
आउटपुट: 1

सीमाएँ:

  • 1 <= nums.length <= 10^4
मुख्य कोड मोड
● अपने आप सहेजा गयापंक्ति 1, कॉलम 1