LeetCode: Search Insert Position

給定一個數值不重複的已排序陣列和目標值,題目要求找出該目標值在這個陣列中的索引位置;若找不到則回傳插入數值的正確排序位置。

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

...繼續閱讀 »