Repeating elements (Find Duplicates)
Condition:
Given a slice of strings. Return a slice of strings that appear more than once in the original slice. The order of elements in the result should be in the order of their first appearance in the original slice.
Input data: []string — slice of strings
Output data: []string — strings that appear more than once, in the order of first appearance
Constraints:
- 0 <= len(input) <= 10^4
- Each string consists of Latin letters, length 1..50
Example:
Input: ["a", "bb", "bb", "aa", "a", "a"]
Output: ["a", "bb"]
def find_duplicates(items):
# TODO: write solution here
return []