/**
 * Main Points:
   The main idea is to store the last seen positions of current (i-th) characters in both strings. 
   If previously stored positions are different then we know that they're not occuring in the current i-th position simultaneously
 * Time Complexity: O(n) n = length of the string
 * Space Complexity: O(512)
**/
class Solution {
    public boolean isIsomorphic(String s, String t) {
        if (s == null && t == null) return true;
        if (s.length() != t.length()) return false;
        
        int[] posOfS = new int[256], posOfT = new int[256];
        for (int i = 0; i < s.length(); i++) {
            if (posOfS[s.charAt(i)] != posOfT[t.charAt(i)]) return false;
            posOfS[s.charAt(i)] = posOfT[t.charAt(i)] = i + 1;
        }
        return true;
    }
}
@@ -789,8 +789,1288 @@
 %0A    %7D%0A%7D
+%0A%0A//follow up%0A/*Given 3 strings s and t and e, determine if they are isomorphic.%0A%0A  For example,%0A  Given %22egg%22, %22add%22, %22foo%22, %22paper%22, %22title%22%EF%BC%8Creturn %7B%7B%22egg%22, %22add%22, %22foo%22%7D%EF%BC%8C%7B%22paper%22, %22title%22%7D%7D.%0A%0A*/%0Apublic class isomorphicString %7B%0A    public List%3CList%3CString%3E%3E isIsomorphic(String%5B%5D inputs) %7B%0A        if (inputs == null %7C%7C inputs.length == 0) return null;%0A%0A        Map%3CString, List%3CString%3E%3E map = new HashMap%3C%3E();%0A%0A        for (String str : inputs) %7B%0A            Map%3CCharacter, Integer%3E indexMap = new HashMap%3C%3E();%0A            int idx = 0;%0A            StringBuilder tmp = new StringBuilder();%0A            for (char c : str.toCharArray()) %7B%0A                char decode;%0A                if (!indexMap.containsKey(c)) %7B%0A                    indexMap.put(c, idx);%0A                    decode = (char)('a' + idx++);%0A                %7D else %7B%0A                    decode = (char)('a' + indexMap.get(c));%0A                %7D%0A                tmp.append(decode);%0A            %7D%0A            String newStr = tmp.toString();%0A            if (!map.containsKey(newStr)) %7B%0A                map.put(newStr, new LinkedList%3C%3E());%0A            %7D%0A            map.get(newStr).add(str);%0A        %7D // for str%0A%0A        List%3CList%3CString%3E%3E res = new ArrayList%3CList%3CString%3E%3E(map.values());%0A        return res;%0A    %7D%0A%7D%0A

add follow up