FrontendX
Is Unique
easy
Description
AI Assistance
Solution
Test Cases
Test Result
Submissions
Canvas
Is
Unique
Implement an algorithm to determine if a string has all unique characters.
Examples
Example 1
Input:
""
Output:
true
Example 2
Input:
"a"
Output:
true
Hints
Hint 1
Try using a hash set. Walk through the string and check if each character already exists in the set.
Hint 2
Can you solve it without using additional data structures? Consider sorting the string first.
Hint 3
For the in-place approach, sort the characters and then check if any adjacent pair is equal.
Related Problems
check-permutation
palindrome-permutation
Is Unique
Implement an algorithm to determine if a string has all unique characters.