forked from doocs/leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,227 changed files
with
52,536 additions
and
35,251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
173 changes: 104 additions & 69 deletions
173
solution/0000-0099/0005.Longest Palindromic Substring/README_EN.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,104 @@ | ||
# [5. Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring) | ||
|
||
[中文文档](/solution/0000-0099/0005.Longest%20Palindromic%20Substring/README.md) | ||
|
||
## Description | ||
|
||
<p>Given a string <code>s</code>, return <em>the longest palindromic substring</em> in <code>s</code>.</p> | ||
<p> </p> | ||
<p><strong>Example 1:</strong></p> | ||
<pre> | ||
<strong>Input:</strong> s = "babad" | ||
<strong>Output:</strong> "bab" | ||
<strong>Note:</strong> "aba" is also a valid answer. | ||
</pre> | ||
<p><strong>Example 2:</strong></p> | ||
<pre> | ||
<strong>Input:</strong> s = "cbbd" | ||
<strong>Output:</strong> "bb" | ||
</pre> | ||
<p><strong>Example 3:</strong></p> | ||
<pre> | ||
<strong>Input:</strong> s = "a" | ||
<strong>Output:</strong> "a" | ||
</pre> | ||
<p><strong>Example 4:</strong></p> | ||
<pre> | ||
<strong>Input:</strong> s = "ac" | ||
<strong>Output:</strong> "a" | ||
</pre> | ||
<p> </p> | ||
<p><strong>Constraints:</strong></p> | ||
<ul> | ||
<li><code>1 <= s.length <= 1000</code></li> | ||
<li><code>s</code> consist of only digits and English letters (lower-case and/or upper-case),</li> | ||
</ul> | ||
|
||
## Solutions | ||
|
||
<!-- tabs:start --> | ||
|
||
### **Python3** | ||
|
||
```python | ||
|
||
``` | ||
|
||
### **Java** | ||
|
||
```java | ||
|
||
``` | ||
|
||
### **...** | ||
|
||
``` | ||
|
||
``` | ||
|
||
<!-- tabs:end --> | ||
# [5. Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring) | ||
|
||
[中文文档](/solution/0000-0099/0005.Longest%20Palindromic%20Substring/README.md) | ||
|
||
## Description | ||
|
||
<p>Given a string <code>s</code>, return <em>the longest palindromic substring</em> in <code>s</code>.</p> | ||
|
||
|
||
|
||
<p> </p> | ||
|
||
<p><strong>Example 1:</strong></p> | ||
|
||
|
||
|
||
<pre> | ||
|
||
<strong>Input:</strong> s = "babad" | ||
|
||
<strong>Output:</strong> "bab" | ||
|
||
<strong>Note:</strong> "aba" is also a valid answer. | ||
|
||
</pre> | ||
|
||
|
||
|
||
<p><strong>Example 2:</strong></p> | ||
|
||
|
||
|
||
<pre> | ||
|
||
<strong>Input:</strong> s = "cbbd" | ||
|
||
<strong>Output:</strong> "bb" | ||
|
||
</pre> | ||
|
||
|
||
|
||
<p><strong>Example 3:</strong></p> | ||
|
||
|
||
|
||
<pre> | ||
|
||
<strong>Input:</strong> s = "a" | ||
|
||
<strong>Output:</strong> "a" | ||
|
||
</pre> | ||
|
||
|
||
|
||
<p><strong>Example 4:</strong></p> | ||
|
||
|
||
|
||
<pre> | ||
|
||
<strong>Input:</strong> s = "ac" | ||
|
||
<strong>Output:</strong> "a" | ||
|
||
</pre> | ||
|
||
|
||
|
||
<p> </p> | ||
|
||
<p><strong>Constraints:</strong></p> | ||
|
||
|
||
|
||
<ul> | ||
<li><code>1 <= s.length <= 1000</code></li> | ||
<li><code>s</code> consist of only digits and English letters (lower-case and/or upper-case),</li> | ||
</ul> | ||
|
||
## Solutions | ||
|
||
<!-- tabs:start --> | ||
|
||
### **Python3** | ||
|
||
```python | ||
|
||
``` | ||
|
||
### **Java** | ||
|
||
```java | ||
|
||
``` | ||
|
||
### **...** | ||
|
||
``` | ||
``` | ||
|
||
<!-- tabs:end --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.