@@ -0,0 +1,1148 @@
+/**%0A * Given a sorted array of integers, find the starting and ending position of a given target value.%0A * Your algorithm's runtime complexity must be in the order of O(log n).%0A * If the target is not found in the array, return %5B-1, -1%5D.%0A * For example, %0A * Given %5B5, 7, 7, 8, 8, 10%5D and target value 8, return %5B3, 4%5D.%0A * %0A */ %0A%0Apublic class Solution %7B%0A    public int%5B%5D searchRange(int%5B%5D nums, int target) %7B%0A        if(nums == null %7C%7Cnums.length == 0)%0A        %09return nums;%0A        int idx, start, end;%0A        if((idx = binarySearch(nums, target)) %3C 0)%0A        %09return new int%5B%5D %7B-1,-1%7D;%0A        start = end = idx;%0A        while(start %3E= 0 && nums%5Bstart%5D == target)%0A        %09start--;%0A        while(end %3C nums.length && nums%5Bend%5D == target)%0A        %09end++;%0A        return new int%5B%5D %7Bstart+1, end-1%7D;%0A    %7D%0A    %0A    private int binarySearch(int%5B%5D nums, int target) %7B%0A    %09int left = 0, right = nums.length-1;%0A    %09while(left %3C= right) %7B%0A    %09%09int mid = left + (right - left)/2;%0A    %09%09if(nums%5Bmid%5D %3E target)%0A    %09%09%09right = mid - 1;%0A    %09%09else if(nums%5Bmid%5D %3C target)%0A    %09%09%09left = mid + 1;%0A    %09%09else%0A    %09%09%09return mid;%0A    %09%7D%0A    %09return -1;%0A    %7D%0A%7D%0A

Create 034.java