File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 147
147
1374|[ Generate a String With Characters That Have Odd Counts] ( ./1374-generate-a-string-with-characters-that-have-odd-counts.js ) |Easy|
148
148
1380|[ Lucky Numbers in a Matrix] ( ./1380-lucky-numbers-in-a-matrix.js ) |Easy|
149
149
1389|[ Create Target Array in the Given Order] ( ./1389-create-target-array-in-the-given-order.js ) |Easy|
150
+ 1408|[ String Matching in an Array] ( ./1408-string-matching-in-an-array.js ) |Easy|
150
151
1472|[ Design Browser History] ( ./1472-design-browser-history.js ) |Medium|
151
152
1598|[ Crawler Log Folder] ( ./1598-crawler-log-folder.js ) |Easy|
152
153
1880|[ Check if Word Equals Summation of Two Words] ( ./1880-check-if-word-equals-summation-of-two-words.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 1408. String Matching in an Array
3
+ * https://leetcode.com/problems/string-matching-in-an-array/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given an array of string words. Return all strings in words which is
7
+ * substring of another word in any order.
8
+ *
9
+ * String words[i] is substring of words[j], if can be obtained removing
10
+ * some characters to left and/or right side of words[j].
11
+ */
12
+
13
+ /**
14
+ * @param {string[] } words
15
+ * @return {string[] }
16
+ */
17
+ var stringMatching = function ( words ) {
18
+ return words . filter ( s => words . some ( word => word !== s && word . includes ( s ) ) ) ;
19
+ } ;
You can’t perform that action at this time.
0 commit comments