One line C++ solution


  • 0
    A
    class Solution {
    public:
        int searchInsert(vector<int>& nums, int target) {
            return lower_bound(nums.begin(), nums.end(), target) - nums.begin();
        }
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.