We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b4dee8f + 92435ea commit 79348b2Copy full SHA for 79348b2
README.md
@@ -307,7 +307,12 @@
307
// If the letter does not exist, create a map and map it to the value
308
// of the second letter
309
if (letterMap[letterA] === undefined) {
310
- letterMap[letterA] = letterB;
+ // If letterB has already been added to letterMap, then we can say: they are not isomorphic.
311
+ if(secondString.indexOf(letterB) < i){
312
+ return false;
313
+ } else {
314
+ letterMap[letterA] = letterB;
315
+ }
316
} else if (letterMap[letterA] !== letterB) {
317
// Eles if letterA already exists in the map, but it does not map to
318
// letterB, that means that A is mapping to more than one letter.
0 commit comments