My 3 lines solution in java


  • 0
    G

    public int searchInsert(int[] nums, int target) {
    int i=0;
    while(i<nums.length&&nums[i]<target) i++;
    return i;
    }


Log in to reply
 

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