Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
1,683 views

For proper oa or interview experiences list of all top tech companies visit :

https://oa.desiqna.in

https://interview.desiqna.in

 

in Online Assessments by Expert (44,360 points)

1 Answer

0 like 0 dislike

Online Assessment Question :

image

 

image

image

image

image


 

by Expert (44,360 points)
0 0
int cntDisPairs(vector<int> arr, int target) {
    unordered_set<int> set;
    unordered_set<int> seen;
     
    int count = 0;
     
    for(int num : arr) {
        if(set.find(target-num) != set.end() && seen.find(num) == seen.end() ) {
            count++;
            seen.insert(num);
            seen.insert(target-num);
        }
        set.insert(num);
    }
    return count;
}
...