Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1cae143

Browse files
author
Jinyue Xia
committed
test git
1 parent1409b67 commit1cae143

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎Easy/205-isomorphicStrings.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,20 @@ Object.prototype.getKeyByValue = function(value) {
3838
}
3939
}
4040
};
41+
42+
// a better solution, use array
43+
varisIsomorphic=function(s,t){
44+
vararrS=[],
45+
arrT=[];
46+
47+
for(vari=0;i<s.length;i++){
48+
if(arrS[s.charCodeAt(i)]!==arrT[t.charCodeAt(i)]){
49+
returnfalse;
50+
}
51+
52+
arrS[s.charCodeAt(i)]=i;
53+
arrT[t.charCodeAt(i)]=i;
54+
}
55+
56+
returntrue;
57+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp