Beats 79.94%!! Shortest code🔥!!BEST Python code🔥!!Token!🔥
Intuition\nI couldn\'t belive this works.\n\n# Approach\nTo use findall from re and then sum the result and boom, shortest code.\n\n# Complexity\n### Time Compl
# Intuition\nI couldn\'t belive this works.\n\n# Approach\nTo use findall from re and then sum the result and boom, shortest code.\n\n# Complexity\n### Time Complexity\n\n1. **Regular Expression Matching**:\n   - `re.findall(r\'[+-]?\\d+/\\d+\', expression)`: Scans through the entire string `expression` to find all matching substrings.\n   - Time complexity: \\( O(n) \\), where \\( n \\) is the length of the input string.\n\n2. **Fraction Parsing**:\n   - `Fraction(token)` for each match: Parsing each fraction takes constant time.\n   - Time complexity: \\( O(m) \\), where \\( m \\) is the number of fractions found.\n\n3. **Summing Fractions**:\n   - `sum(Fraction(token) for token in ...)`: Summing all fractions involves iterating through them.\n   - Time complexity: \\( O(m) \\).\n\n   Since \\( m \\) (number of fractions) is generally proportional to \\( n \\) (length of the input string), the overall time complexity is \\( O(n) \\).\n\n### Space Complexity\n\n1. **Space for Matches**:\n   - Storing all matches from `re.findall` requires \\( O(m) \\) space.\n\n2. **Space for Fractions**:\n   - Storing all `Fraction` objects requires \\( O(m) \\) space.\n\n3. **Space for Result**:\n   - The final formatted string takes \\( O(1) \\) additional space.\n\n   The overall space complexity is \\( O(m) \\), which simplifies to \\( O(n) \\) if the number of fractions \\( m \\) is proportional to the length of the input string \\( n \\).\n\n### Summary\n\n- **Time Complexity**: \\( O(n) \\)\n- **Space Complexity**: \\( O(n) \\)\n\n# Code\n```python3 []\nfrom fractions import Fraction\nimport re\nclass Solution:\n    def fractionAddition(self, expression: str) -> str:\n        fractions = [Fraction(token) for token in re.findall(r\'[+-]?\\d+/\\d+\', expression)]\n        return f"{sum(fractions).numerator}/{sum(fractions).denominator}"\n\n\n```\nCould have been shorter
['Math', 'Shortest Path', 'Python3']