+ 3
Dictionary help
I have dictionaries A and B. How to output all values in dictionary A that not contain substrings from dictionary B? https://code.sololearn.com/cmpGloD6UkL5/?ref=app
5 Antworten
+ 7
nurkanat amirov I don't know if c# has a built-in function for that, so I would iterate trough dic A and check if value exists in dic b
swap keys with values, make domains keys, and then
loop through A {
if (!B.ContainsKey(key)) {
print it or create new array of those that are not in B
}
{
+ 2
Yes that's right
+ 2
But I need the time complexity to be O(N)
+ 2
If I iterate through A in B it will be O(N²) time complexity, and there are 1000000 items in each dictionary it will be much time
+ 2
Thanks everyone, I've solved the problem with regex.
https://code.sololearn.com/chSDAgz7QIor/?ref=app