Let assume I have a word
word = abcde
And a score board to show that the position of the characters in the word is correct or not in comparison to my desired output
score = [T, F, F, T, F]
Where T is for correct position, F is for incorrect. So we will have possible output to be acedb and aebdc.
Now given a list of words
words = [abcde, aaaaa, ababa, acedb, bbced]
Based on the scorer above, I would like to find if in the list 'words' exist the correct anagram of word, which is in this case acedb and returns it
output = [acedb]
How can I achieve this with efficient time complexity ? Can I do this in linear time ?
I don't want to use in-built functions, libraries or set/dict (hash tables) as they might screw up my complexity for further tasks so any help would be appriciated