Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public static bool IsUnique(string inp)
{

Dictionary<char,int> dict = new Dictionary<char,int>();

foreach (char item in inp)
{
if (dict.ContainsKey(item))
return false;
else
dict.Add(item, 1);

}

return true;
}

What I have tried:

I have coded the above function in C# and the code is working fine. Can someone plz help me out with the time complexity of the above code snippet. Thanks in advance.
Posted
Updated 1-Jan-18 23:35pm

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900