For string to be isomorphic the previous counts of appearances of current character in both string must be same if it is not same we return false .
if ( countChars1 [ str1 . charAt ( i ) - ' a ' ] != countChars2 [ str2 . charAt ( i ) - ' a ' ] ) { return false ; } } return true ; }