- Going through queue or words
- for each word, replacing the character from 'a' - 'z' is O(N2) loop
- within each of the above loop if we are using toCharArray and then after replacing the character in the word, we again create a new string out of this char array to form a new word and check this agains the set. So should we add time complexity of O(N) within the O(n2) loop as mentioned in step2 ?
Could someone please explain the time complexity ?