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

Commit db2fc39

Browse files
[LEET-3407] add 3407
1 parent d23fe25 commit db2fc39

File tree

3 files changed

+34
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src

3 files changed

+34
-0
lines changed

‎paginated_contents/algorithms/4th_thousand/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| 3471 | [Find the Largest Almost Missing Integer](https://leetcode.com/problems/find-the-largest-almost-missing-integer/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3471.java) | | Easy |
77
| 3450 | [Maximum Students on a Single Bench](https://leetcode.com/problems/maximum-students-on-a-single-bench/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3450.java) | | Easy |
88
| 3438 | [Find Valid Pair of Adjacent Digits in String](https://leetcode.com/problems/find-valid-pair-of-adjacent-digits-in-string/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3438.java) | | Easy |
9+
| 3407 | [Substring Matching Pattern](https://leetcode.com/problems/substring-matching-pattern/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3407.java) | | Easy |
910
| 3402 | [Minimum Operations to Make Columns Strictly Increasing](https://leetcode.com/problems/minimum-operations-to-make-columns-strictly-increasing/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3402.java) | | Easy |
1011
| 3396 | [Minimum Number of Operations to Make Elements in Array Distinct](https://leetcode.com/problems/minimum-number-of-operations-to-make-elements-in-array-distinct/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3396.java) | | Easy |
1112
| 3392 | [Count Subarrays of Length Three With a Condition](https://leetcode.com/problems/count-subarrays-of-length-three-with-a-condition/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3392.java) | | Easy |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
public class _3407 {
4+
public static class Solution1 {
5+
public boolean hasMatch(String s, String p) {
6+
int index = p.indexOf('*');
7+
int firstPos = s.indexOf(p.substring(0, index));
8+
int secondPos = s.indexOf(p.substring(index + 1), firstPos + index);
9+
return firstPos != -1 && secondPos != -1;
10+
}
11+
}
12+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.fourththousand;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import com.fishercoder.solutions.fourththousand._3407;
6+
import org.junit.jupiter.api.BeforeEach;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class _3407Test {
10+
private _3407.Solution1 solution1;
11+
12+
@BeforeEach
13+
public void setup() {
14+
solution1 = new _3407.Solution1();
15+
}
16+
17+
@Test
18+
public void test1() {
19+
assertEquals(false, solution1.hasMatch("nrnrs", "*nn"));
20+
}
21+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /