LeetCode 205. Isomorphic Strings
class Solution { public boolean isIsomorphic(String s, String t) { if(s.length()!=t.length()){ return false; } char[] sChar = new char[256]; char[] tChar = new char[256]; for(int i=0; i<s.length(); i++){ char sc = s.charAt(i); char tc = t.charAt(i); if(sChar[sc] == 0 && tChar[tc] == 0){ sChar[sc] = tc; tChar[tc] = sc; }else if(sChar[sc] != tc){ return false; } System.out.println(sc); System.out.println(tc); } return true; } }