35. Search Insert Position

題目: 解答: 使用二分查找,注意確定插入位置的方法。 下面代碼注意註釋的位置,爲何可以這樣優化掉。 代碼: class Solution { public: int searchInsert(vector<int>& nums, int begin, int end, int target){ if(begin >= end) return begin;
相關文章
相關標籤/搜索