Perficient Interview Question

Print all duplicates in a string array.

Interview Answer

Anonymous

Jul 20, 2018

2 for loops (O(n^2)) time complexity. Marginally better would be to keep a track of the positions in the string array where reputation/duplication occurs, and skip those positions for future passes. Another way would be to use a hash map.

1