Skip to content

Commit bc1375b

Browse files
committed
Create README - LeetHub
1 parent fd771bf commit bc1375b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<h2><a href="https://leetcode.com/problems/regular-expression-matching">10. Regular Expression Matching</a></h2><h3>Hard</h3><hr><p>Given an input string <code>s</code>&nbsp;and a pattern <code>p</code>, implement regular expression matching with support for <code>&#39;.&#39;</code> and <code>&#39;*&#39;</code> where:</p>
2+
3+
<ul>
4+
<li><code>&#39;.&#39;</code> Matches any single character.​​​​</li>
5+
<li><code>&#39;*&#39;</code> Matches zero or more of the preceding element.</li>
6+
</ul>
7+
8+
<p>The matching should cover the <strong>entire</strong> input string (not partial).</p>
9+
10+
<p>&nbsp;</p>
11+
<p><strong class="example">Example 1:</strong></p>
12+
13+
<pre>
14+
<strong>Input:</strong> s = &quot;aa&quot;, p = &quot;a&quot;
15+
<strong>Output:</strong> false
16+
<strong>Explanation:</strong> &quot;a&quot; does not match the entire string &quot;aa&quot;.
17+
</pre>
18+
19+
<p><strong class="example">Example 2:</strong></p>
20+
21+
<pre>
22+
<strong>Input:</strong> s = &quot;aa&quot;, p = &quot;a*&quot;
23+
<strong>Output:</strong> true
24+
<strong>Explanation:</strong> &#39;*&#39; means zero or more of the preceding element, &#39;a&#39;. Therefore, by repeating &#39;a&#39; once, it becomes &quot;aa&quot;.
25+
</pre>
26+
27+
<p><strong class="example">Example 3:</strong></p>
28+
29+
<pre>
30+
<strong>Input:</strong> s = &quot;ab&quot;, p = &quot;.*&quot;
31+
<strong>Output:</strong> true
32+
<strong>Explanation:</strong> &quot;.*&quot; means &quot;zero or more (*) of any character (.)&quot;.
33+
</pre>
34+
35+
<p>&nbsp;</p>
36+
<p><strong>Constraints:</strong></p>
37+
38+
<ul>
39+
<li><code>1 &lt;= s.length&nbsp;&lt;= 20</code></li>
40+
<li><code>1 &lt;= p.length&nbsp;&lt;= 20</code></li>
41+
<li><code>s</code> contains only lowercase English letters.</li>
42+
<li><code>p</code> contains only lowercase English letters, <code>&#39;.&#39;</code>, and&nbsp;<code>&#39;*&#39;</code>.</li>
43+
<li>It is guaranteed for each appearance of the character <code>&#39;*&#39;</code>, there will be a previous valid character to match.</li>
44+
</ul>

0 commit comments

Comments
 (0)