Skip to content

Commit ff3d7f8

Browse files
Merge pull request akshitagit#22 from sauravsolanki/feature/check-anagram
Feature/check anagram
2 parents 7895427 + e33acc3 commit ff3d7f8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/*

Strings/anagram.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default class Anagram {
2+
3+
static isAnagram(str1, str2) {
4+
if (str1.length !== str2.length) {
5+
// check if the length is same
6+
//{result:false,err:"LengthShouldBeSame"}
7+
return false
8+
} else {
9+
// ;
10+
return str1.split('').sort().join('') === str2.split('').sort().join('');
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)