Java faster solution 0m 100% using (lastIndexOf)
\npublic int maxLengthBetweenEqualCharacters(String s) {\n\t\tint max = -1;\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\tint lastIndex= s.lastIndexOf(s.ch
```\npublic int maxLengthBetweenEqualCharacters(String s) {\n\t\tint max = -1;\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\tint lastIndex= s.lastIndexOf(s.charAt(i));\n\t\t\tif(lastIndex != i) \n\t\t\t\tmax = Math.max(max, lastIndex - (i+1));\n\t\t}\n\t\treturn max;\n    }\n```
['Java']