@@ -0,0 +1,1019 @@
+public class Solution %7B%0A    public int%5B%5D searchRange(int%5B%5D nums, int target) %7B%0A        int%5B%5D error = %7B-1, -1%7D;%0A        int%5B%5D result = new int%5B2%5D;%0A        if(nums.length == 0)%7B%0A            return error;%0A        %7D%0A        int left = 0, right = nums.length-1;%0A        while(left %3C= right)%7B%0A            int mid = left + (right - left)/2;%0A            int i;%0A            if(nums%5Bmid%5D == target)%7B%0A                for(i = mid; i %3E= left; i --)%7B%0A                    if(nums%5Bi%5D != target)%7B%0A                        break;%0A                    %7D%0A                %7D%0A                result%5B0%5D = i%3Cleft? left: i+1;%0A                for(i = mid; i %3C= right; i ++)%7B%0A                    if(nums%5Bi%5D != target)%7B%0A                        break;%0A                    %7D%0A                %7D%0A                result%5B1%5D = i%3Eright? right: i-1;%0A                return result;%0A            %7Delse if(nums%5Bmid%5D %3C target)%7B%0A                left = mid + 1;%0A            %7Delse%7B%0A                right = mid - 1;%0A            %7D%0A        %7D%0A        return error;%0A    %7D%0A%7D

Q34 Search for a Range