I have a list of strings, I need to be able to simply probe if a new string is in the table or not. When the list is large, testing a simple list directly is pretty inefficient... so typically I use a Dictionary to get constant lookup speeds, although I don't actually care about the value. This seems like a misuse of a dictionary, so I'm wondering what other approaches I could take.
Is there a better way to do hit testing that I am unaware of?
A String is said to be 'Unique' if none of the alphabets resent in the string are repeated. Write a program to accept a string and check whether the string is Unique or not. Example :- Input: COMPUTER. Output:Unique String.
Unlike most other modern languages such as Java, C++ and JavaScript, C does not provide a separate type for strings. A string is considered an array of characters terminated by a 0 character (denoted "\0"). The length of the string is denoted by a convention: the number of characters until the 0 character.
You should use a HashSet<string>
, which is specifically designed for this purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With