To check if a string has all unique characters, insert each character into a set. If s.size() == str.length() after inserting all characters, then all characters are unique. Or check during insertion: if (!seen.insert(c).second) return false; catches duplicates immediately.
This returns false as soon as a repeated character is found. For ASCII characters, an array of 128 bools works too and may be faster. But sets handle any character type including Unicode without making size assumptions about the character set.