Find First Unique
Problem Overview
- Task: Given a lowercase string, return the 1-based index of the first character that appears exactly once, or -1 if none.
- Input/Output: Input string s (1 ≤ length(s) ≤ 100000), lowercase English letters; output an integer index or -1.
- Context: Models AWS search query optimization using the position of the first unique character.
- Source: Asked in Amazon interviews; a coding interview problem and common interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
