Skip to content

Commit 73c3084

Browse files
add 1624
1 parent fe68891 commit 73c3084

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1624|[Largest Substring Between Two Equal Characters](https://leetcode.com/problems/largest-substring-between-two-equal-characters/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1624.java) ||String|Easy|
1112
|1620|[Coordinate With Maximum Network Quality](https://leetcode.com/problems/coordinate-with-maximum-network-quality/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1620.java) ||Greedy|Medium|
1213
|1619|[Mean of Array After Removing Some Elements](https://leetcode.com/problems/mean-of-array-after-removing-some-elements/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1620.java) ||Array|Easy|
1314
|1614|[Maximum Nesting Depth of the Parentheses](https://leetcode.com/problems/maximum-nesting-depth-of-the-parentheses/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1614.java) ||Easy|String|
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1624 {
4+
public static class Solution1 {
5+
public int maxLengthBetweenEqualCharacters(String s) {
6+
int maxLen = -1;
7+
for (int i = 0; i < s.length(); i++) {
8+
char c = s.charAt(i);
9+
int lastIndex = s.lastIndexOf(c);
10+
if (lastIndex != i) {
11+
maxLen = Math.max(maxLen, Math.abs(lastIndex - i - 1));
12+
}
13+
}
14+
return maxLen;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)