Class Solution
java.lang.Object
g1601_1700.s1624_largest_substring_between_two_equal_characters.Solution
1624 - Largest Substring Between Two Equal Characters.<p>Easy</p>
<p>Given a string <code>s</code>, return <em>the length of the longest substring between two equal characters, excluding the two characters.</em> If there is no such substring return <code>-1</code>.</p>
<p>A <strong>substring</strong> is a contiguous sequence of characters within a string.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “aa”</p>
<p><strong>Output:</strong> 0</p>
<p><strong>Explanation:</strong> The optimal substring here is an empty substring between the two <code>'a's</code>.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “abca”</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> The optimal substring here is “bc”.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> s = “cbzxy”</p>
<p><strong>Output:</strong> -1</p>
<p><strong>Explanation:</strong> There are no characters that appear twice in s.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 300</code></li>
<li><code>s</code> contains only lowercase English letters.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
maxLengthBetweenEqualCharacters
-