private boolean containsAndUpdate(Map<Character, Integer> currentCount,
            Map<Character, Integer> count, Character ch,
            Map<Character, Integer> pos, int index) {
        if (count.containsKey(ch)) {
            if(currentCount.containsKey(ch)) {
                if (currentCount.get(ch) < count.get(ch)) {
                    if (currentCount.get(ch) == 1) {
                        pos.put(ch, index);
                    }
                    currentCount.put(ch, currentCount.get(ch) + 1);
                    return true;
                }
            }else{
                currentCount.put(ch, 1);
                pos.put(ch,index);
                return true;
            }
        }
        return false;
    }
http://www.careercup.com/question?id=5389078581215232
Given two strings tells if anagram of first is substring of another
Keep map of characters in array1 and keep checking if array2 has these characters.
main string : a b a c a b b and looking for a a b b c when 3rd a is encountered
we move index to second a and start from there.

Another idea is to keep a sorted linklist of string in comparison. Whenever a new character
is to be added remove last character from linklist and add this new one.
src/com/interview/string/AnagramOfFirstAsSubstring.java