This question evaluates a candidate's proficiency in string processing, frequency analysis, and algorithmic complexity, focusing on identifying the first non-repeating character while considering time and space trade-offs.
Given a lowercase/uppercase alphanumeric string s, return the index of the first character that appears exactly once; if none exists, return -1. Provide an O(n) approach and discuss space–time trade-offs against sorting-based solutions.