employer cover photo
employer logo
employer logo

Tableau Software

Fait partie de Salesforce

Est-ce votre entreprise ?

Question d’entretien chez Tableau Software

Why do you want to join Tableau? Find the smallest unique integer in a random integer array with possible duplicates.

Réponses aux questions d'entretien

Utilisateur anonyme

1 oct. 2015

make a hash map, first go through each number and put it in hash map. Then go through each number again, check the value in hash map, if it is equal to 1, then compare this with min(you can make it Integer.max_val at the beginning), and keep updating this min.

3

Utilisateur anonyme

3 août 2015

Sort the array and loop through the sorted array. Return the element once you find it's not same as it's previous element or it's next element. N(log(N) + O(N) complexity

1

Utilisateur anonyme

16 sept. 2015

May not be the best solution. I think you can use a set to keep track of the unique integers in this array, and then iteratively visit the elements in the set to find the smallest element. O(N). S(N).

Utilisateur anonyme

16 sept. 2015

By set I mean, map, you need to keep track of how many times each element occurs. To find smallest element, you only need to consider the elements that only occurs once.

Utilisateur anonyme

27 sept. 2016

Sorting is not the best answer -- the sort itself is O(n log n). HashMap is better (can use a bool instead of int as the value though -- just need to know if it's dupe or not, so no need to update the value M times. :)