Java 5 lines of cade | Beats 100%
Runtime: 0 ms, faster than 100.00% of Java online submissions for Largest Substring Between Two Equal Characters.\nMemory Usage: 36.8 MB, less than 67.32% of Ja
Runtime: 0 ms, faster than 100.00% of Java online submissions for Largest Substring Between Two Equal Characters.\nMemory Usage: 36.8 MB, less than 67.32% of Java online submissions for Largest Substring Between Two Equal Characters.\n\n```\n\npublic int maxLengthBetweenEqualCharacters(String s) {\n\tint[] arr = new int[26];\n\tint max = -1;\n\tfor(int i = 0 ; i < s.length() ; i++) arr[s.charAt(i) - \'a\'] = i; \n\tfor(int i = 0 ; i < s.length() ; i++) max = Math.max((arr[s.charAt(i) -\'a\'] - i - 1),max);\n\treturn max;\n}\n\n```
['Java']