Find the indices with anagram match

Given a String and a pattern find all the indices at which where we find an anagram match. For example: String : BACDGABCDA Pattern : ABCD We can find a match at {0, 5, 6} In other words, if we find 4 consecutive characters from these indices, it contains the characters needed to match the pattern. Your solution should implement the following interface: public interface AnagramSearchIndexInterface { public List<Integer> anagramSubstringSearch(String source, String pattern); }

Answer

No comments:

Post a Comment