[Python] Generate. Beats 94% runtime and 91% memory
For a string slice, we generate a list of numbers with following rules:\n1. If the slice is \'0\', then return [\'0\']\n2. If the slice starts and ends with \'0
For a string slice, we generate a list of numbers with following rules:\n1. If the slice is `\'0\'`, then return `[\'0\']`\n2. If the slice starts and ends with `\'0\'`, we generate nothing. Because we cannot have `0.****0`\n3. If the slice starts with `\'0\'`, then the only number we generate is `0.****`\n4. If the slice does not start with `\'0\'`, but ends with `\'0\'`, which means we can only generate `*****0` without decimal point. Otherwise, we\'d end up with `***.***0`\n5. If the slice does not start with or end with `\'0\'`, then we can generate lots of numbers by inserting the decimal points at any position. For example, using `ABCD` as a base, then we can generate `A.BCD`, `AB.CD`, `ABC.D`.\n```python\nclass Solution:\n    def ambiguousCoordinates(self, s: str) -> List[str]:\n        s = s[1:-1] # remove parenthesis\n        def generateNumbers(start, end):\n            if s[start] == \'0\': \n                if end == start: return [\'0\'] # rule 1\n                elif s[end] == \'0\': return [] # rule 2\n                else: return [f\'{s[start]}.{s[start+1:end+1]}\'] # rule 3\n            base = s[start:end+1]\n            res = [base]\n            if s[end] != \'0\': # rule 4\n                for i in range(1, len(base)): # rule 5\n                    res.append(f\'{base[:i]}.{base[i:]}\')\n            return res\n        size = len(s)\n        res = []\n        for split in range(1, size):\n            for first in generateNumbers(0, split - 1):\n                for second in generateNumbers(split, size - 1):\n                    res.append(f\'({first}, {second})\')\n        return res\n            \n```
[]