We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. C++
  3. STL
  4. Sets-STL
  5. Discussions

Sets-STL

Problem
Submissions
Leaderboard
Discussions

    You are viewing a single comment's thread. Return to all comments →

  • garghimanshu1512
    3 months ago+ 0 comments

    include

    include

    include

    include

    include

    include

    using namespace std;

    int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */

    int n;
    cin>>n;
    
    set<int> s;
    
    while(n--){
        int a,b;
        cin>>a>>b;
        if(a==1){
            s.insert(b);
        }
        else if(a==2){
            s.erase(b);
        }
        else if(a==3){
            set<int>::iterator itr = s.find(b);
            if(itr!=s.end()){
                cout<<"Yes"<<endl;
            }
            else{
                cout<<"No"<<endl;
            }
        }
    }
    
    return 0;
    

    }

    
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy