6. Search Insert Position
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
Given a sorted array and a target value, return its index or the index where it would be inserted.
輸入: nums = [1,3,5,6], target = 5 輸出: 2
輸入: nums = [1,3,5,6], target = 2 輸出: 1
1 <= nums.length <= 10^4