File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 48
48
219|[ Contains Duplicate II] ( ./0219-contains-duplicate-ii.js ) |Easy|
49
49
226|[ Invert Binary Tree] ( ./0226-invert-binary-tree.js ) |Easy|
50
50
234|[ Palindrome Linked List] ( ./0234-palindrome-linked-list.js ) |Easy|
51
+ 242|[ Valid Anagram] ( ./0242-valid-anagram.js ) |Easy|
51
52
263|[ Ugly Number] ( ./0263-ugly-number.js ) |Easy|
52
53
264|[ Ugly Number II] ( ./0264-ugly-number-ii.js ) |Medium|
53
54
268|[ Missing Number] ( ./0268-missing-number.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 242. Valid Anagram
3
+ * https://leetcode.com/problems/valid-anagram/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given two strings s and t, return true if t is an anagram of s, and false otherwise.
7
+ */
8
+
9
+ /**
10
+ * @param {string } s
11
+ * @param {string } t
12
+ * @return {boolean }
13
+ */
14
+ var isAnagram = function ( s , t ) {
15
+ const sort = str => str . split ( '' ) . sort ( ) . join ( '' ) ;
16
+ return sort ( s ) === sort ( t ) ;
17
+ } ;
You can’t perform that action at this time.
0 commit comments