PubMatic Interview Question

Find max and 2nd max array elements. check if duplicates are are present in an array or not

Interview Answer

Anonymous

Aug 18, 2020

1. Sort the array using sort() function and return last and second last element in c++ 2. Using Map we can check duplicates . Insert all elements in map and check the count. If count >1 , duplicate found