Booz Allen Hamilton interview question

Write a function that counts duplicates in an array.

Interview Answer

Anonymous

Jun 26, 2019

One approach to this is to grab an element and check it against the segment of the array after the index of said element. Do that until the remainder of the array is gone. This process is approximately 11 times more compute efficient than creating a temp array, pushing in array values and scanning for redundancy on each iteration.