Skip to content

Commit 3a7d434

Browse files
committed
fix: ineffective solution
No.1408.String Matching in an Array
1 parent 9658a78 commit 3a7d434

File tree

3 files changed

+3
-37
lines changed

3 files changed

+3
-37
lines changed

solution/1400-1499/1408.String Matching in an Array/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function stringMatching(words: string[]): string[] {
138138
const res: string[] = [];
139139
for (const target of words) {
140140
for (const word of words) {
141-
if (word === target && word.includes(target)) {
141+
if (word !== target && word.includes(target)) {
142142
res.push(target);
143143
break;
144144
}

solution/1400-1499/1408.String Matching in an Array/README_EN.md

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -129,41 +129,7 @@ function stringMatching(words: string[]): string[] {
129129
const res: string[] = [];
130130
for (const target of words) {
131131
for (const word of words) {
132-
if (word === target && word.includes(target)) {
133-
res.push(target);
134-
break;
135-
}
136-
}
137-
}
138-
return res;
139-
}
140-
```
141-
142-
### **Rust**
143-
144-
```rust
145-
impl Solution {
146-
pub fn string_matching(words: Vec<String>) -> Vec<String> {
147-
let mut res = Vec::new();
148-
for target in words.iter() {
149-
for word in words.iter() {
150-
if word != target && word.contains(target) {
151-
res.push(target.clone());
152-
break;
153-
}
154-
}
155-
}
156-
res
157-
}
158-
}
159-
```### **TypeScript**
160-
161-
```ts
162-
function stringMatching(words: string[]): string[] {
163-
const res: string[] = [];
164-
for (const target of words) {
165-
for (const word of words) {
166-
if (word === target && word.includes(target)) {
132+
if (word !== target && word.includes(target)) {
167133
res.push(target);
168134
break;
169135
}

solution/1400-1499/1408.String Matching in an Array/Solution .ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function stringMatching(words: string[]): string[] {
22
const res: string[] = [];
33
for (const target of words) {
44
for (const word of words) {
5-
if (word === target && word.includes(target)) {
5+
if (word !== target && word.includes(target)) {
66
res.push(target);
77
break;
88
}

0 commit comments

Comments
 (0)