Basic example
Input
s = "leetcode"
Output
l
The characters 'l', 'e', 't', 'c', 'o', 'd' appear; 'l' is the first that appears only once.
Full lesson preview
Return the first non-repeating character in a string (or an empty string if none).
Problem statement
Task
Examples
Input
s = "leetcode"
Output
l
The characters 'l', 'e', 't', 'c', 'o', 'd' appear; 'l' is the first that appears only once.
Input format
Output format
Constraints
Samples
Input
first_unique_char("loveleetcode")
Output
v
Characters: l->2, o->2, v->1, e->4 so 'v' is the first unique character.