My java solution which beat 90%+


  • 0
    F

    public class Solution {
    public boolean isIsomorphic(String s, String t) {
    char [] char1 = s.toCharArray();
    char [] char2 = t.toCharArray();
    int l = s.length();
    int m []= new int[l];
    int n []= new int[l];
    if(s.length()!=t.length()) return false;
    else{

            for(int i=0;i<l;i++){
                m[i]+=s.indexOf(char1[i]);
                n[i]+=t.indexOf(char2[i]);
            }
            if(Arrays.equals(m,n)){
                return true;
            }
            
            
        }
        return false;
    }
    

    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.