59ms runtime beats 98% direct solution beginner friendly
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {string} s\n * @return {number}\n */\nvar maxLengthBetweenEqualCharacters = function(s) {\n    let max = -Infinity\n    for (let i = 0; i < s.length; i++) {\n        for (let j = s.length - 1; j > i; j--) {\n            if (s[i] == s[j]) {\n                max = Math.max(max, j - i - 1)\n                break;\n            }\n        }\n    }\n    if (max == -Infinity) return -1\n    return max\n};\n```
['JavaScript']