Python short and clean. Functional programming.
Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(n)\n\nwhere,\nn is length of s.\n\n# Code\npython\nclass Solution:\n    def maxLengthBetweenEqualCh
# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(n)$$\n\nwhere,\n`n is length of s`.\n\n# Code\n```python\nclass Solution:\n    def maxLengthBetweenEqualCharacters(self, s: str) -> int:\n        d = defaultdict(lambda: (-inf, inf))\n        for i, x in enumerate(s): d[x] = (max(d[x][0], i), min(d[x][1], i))\n        return max(starmap(sub, d.values())) - 1\n\n\n```
['Hash Table', 'String', 'Python', 'Python3']