Ambiguous Coordinates
Complexity
Time complexity: O(N)

Space complexity: O(N)
Code


# Complexity
- Time complexity: O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(N)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python []
class Solution(object):
    def ambiguousCoordinates(self, s):
        """
        :type s: str
        :rtype: List[str]
        """
        def generate_numbers(sub):
            """
            Generating all valid representations of a number (integer or decimal).
            """
            n = len(sub)
            if n == 0:
                return []
            if n == 1 or sub[0] != '0':  
                results = [sub]
            else:
                results = []

            for i in range(1, n):
                left, right = sub[:i], sub[i:]
                if (left == "0" or left[0] != "0") and right[-1] != "0":
                    results.append(left + "." + right)

            return results

        s = s[1:-1]  
        n = len(s)
        results = []

        for i in range(1, n):
            left_part = generate_numbers(s[:i])
            right_part = generate_numbers(s[i:])

            for l in left_part:
                for r in right_part:
                    results.append("(" + l + ", " + r + ")")

        return results

```
['String', 'Backtracking', 'Enumeration', 'Python']