Lower Bound-STL

Sort by

recency

|

436 Discussions

|

  • + 0 comments

    include

    include

    using namespace std;

    int main() { int n; cin>>n; vectorm; for(int i=0;i>temp; m.push_back(temp); } int q; cin>>q; for(int i=0;i>temp; vector::iterator it; it=lower_bound(m.begin(),m.end(),temp); if(*(it+1)==temp||*it==temp){ cout<<"Yes"<<" "<

  • + 0 comments

    Here is Lower Bound - STL problem solution in C++ - https://programmingoneonone.com/hackerrank-lower-bound-stl-solution-in-cpp.html

  • + 1 comment

    Hey guys..C++ solution

    int main() {

    long long n; cin>>n; vectora(n); for(long long i=0; i>a[i];

    long long q; cin>>q; for(int i=0; i>x;

    auto it=lower_bound(a.begin(),a.end(),x);
    long long index=it - a.begin();
    
    if(it!=a.end() && *it==x)
    {
        cout<<"Yes"<<" "<<index+1<<endl;
    }
    else 
    {
      cout<<"No"<<" "<<index+1<<endl;
    }
    

    }

    }
    
  • + 0 comments

    c++14

        /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
        int n =0;
        int x =0;
        vector<int>vek;
        cin>>n;
        while (n > 0) {
            cin>>x;
            vek.push_back(x);
            n--;
        }
        int q=0;
        cin>>q;
        while (q > 0) {
            int y =0;
            vector<int>::iterator it;
            cin>>y;
            it = lower_bound(vek.begin(),vek.end(), y);
            if (*it!=y) {
                cout<<"No "<<(it-vek.begin()+1)<<'\n';
            }else
            {cout<<"Yes "<<(it-vek.begin()+1)<<'\n';}
            q--;
        }
    
  • + 0 comments

    I want to use this css in website getseedsrightheredotcom for better function,is it possible