#527 Removing Duplicates Starting from the Third Occurrence

Companies:
Sberbank
Themes:
JavaCollections & GenericsPractice

Remove elements from the list starting with the third occurrence:

// Input: ['A', 'B', 'A', 'B', 'A', 'B', 'C', 'C', 'D', 'C', 'C']
// Output: [A, B, A, B, C, C, D]

List<Character> removeDuplicates(List<Character> elements) {
    ...
}

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in