My 5ms accepted Java code


  • 0
    D

    class Solution {
    public int searchInsert(int[] nums, int target) {
    int i = Arrays.binarySearch(nums,target);
    i = i>=0?i:-i-1;
    return i;
    }
    }


Log in to reply
 

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