Determine if a string has all Unique Characters
Solutions
Approach 1 – Brute Force Technique
public bool UniqueCharacters(string str)
{
for (int i = 0; i < str?.Length; i++)
for (int j = i + 1; j < str?.Length; j++)
if (str[i] == str[j])
return false;
return true;
}Approach 2 – Sorting
Approach 3 – Use of Extra Data Structure
Last updated