Given a string s, return the index of the first character that appears exactly once; if none exists, return -1. Assume s may include both lowercase and uppercase English letters. Clarify whether the check is case-sensitive and implement both case-sensitive and case-insensitive variants. Follow-ups:
(
-
Optimize for a small fixed alphabet—can you use constant extra space?
(
-
How would you support full Unicode, including grapheme clusters and normalization issues?
(
-
If s arrives as a stream too large for memory, how would you detect the first unique character online? Analyze time and space complexity.