Given a string, how can you check if a set of characters exist (and find their location) inside the string such that the characters need to be in the same order but not consecutive.
for example the string “INEEDTOGETAHAIRCUT” and the set to find {‘O’,’E’,’G’,’T’}
Thanks
(ps – i have already tried a brute force attempt but it is terrible and doesn’t work!)
Provided I’m not 100% sure of what you mean with “the characters follow each other”, here is a possible approach: generate all the possible permutations of the characters sequence
and search for the permutation