C++ solution // Easy approach//


#1
int binaryleft(vector<int> a,int x)
{
    int n=a.size();
    int ans=-1;
    int l=0, r=n-1;
         while(l<=r)
     {
         int mid=l+(r-l)/2;
         if(a[mid]==x)
         {
            ans=mid;
            r=mid-1;
         }
         else if(a[mid]>x)
         {
             r=mid-1;
         }
         else l=mid+1;
     }
     return ans;;
}

int binaryright(vector<int> a,int x)
{
    int n=a.size();
    int ans=-1;
    int l=0, r=n-1;
         while(l<=r)
     {
         int mid=l+(r-l)/2;
         if(a[mid]==x)
         {
            ans=mid;
            l=mid+1;
         }
         else if(a[mid]>x)
         {
             r=mid-1;
         }
         else l=mid+1;
     }
     return ans;;
}




vector<int> Solution::searchRange(const vector<int> &A, int B) {
    int lind=binaryleft(A,B);
    int rind=binaryright(A,B);
    vector<int> v;
    v.push_back(lind);
    v.push_back(rind);
    return v;
    
}