Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,740 views
in Online Assessments by Expert (111,530 points) | 1,740 views

3 Answers

0 like 0 dislike
// Picnic Question

#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n;

    cin >> n;

    unordered_map<int, int> cmp_check;

    int count = 0;

    vector<int> comp(n, 0);

    for (int i = 0; i < n; i++)

    {

        cin >> comp[i];

    }

    for (int i = 0; i < n; i++)

    {

        int c_val = comp[i];

        cmp_check[c_val]++;

        if (cmp_check[c_val] == 2)

        {

            count++;

            cmp_check.clear();

        }

    }

    cout << count << endl;

    return 0;

}
by (300 points)
0 like 0 dislike

Question asked : 

image

image

image

by Expert (111,530 points)
0 like 0 dislike

Question asked : 

image

by Expert (111,530 points)