class Solution:
    def searchRange(self, nums, target):
        if not nums:
            return [-1,-1]
        self.ans=[]
        def helper(nums,n,target):
            temp_left,temp_right=n,n+1
            while(temp_left>=0):
                if nums[temp_left]==target:
                    self.ans.append(temp_left)
                else:break
                temp_left-=1
            while(temp_right<len(nums)):
                if nums[temp_right]==target:
                    self.ans.append(temp_right)
                else:break
                temp_right+=1
            self.ans.sort()
        left,right=0,len(nums)
        while right>=left and left<len(nums) and right>=0:
            mid=int((right+left)/2)
            if nums[mid]<target:
                left=mid+1
            elif nums[mid]>target:
                right=mid-1
            else:
                helper(nums,mid,target)
                return [self.ans[0],self.ans[-1]]
        return [-1,-1]
s=Solution()
nums=[2,2]
target=3
print(s.searchRange(nums,target))