โ† UBS questions

Find the First Duplicate Character in a String

Filed under UBS

The question

Given a string, write an efficient O(n) algorithm to find and return the first duplicate character using data structures like a HashMap.

No write-up yet. Related questions below have one.

Related UBS questions

Collected from public candidate posts and coding forums. Updated Nov 2026.