You are given two integers — a numerator and a denominator — representing a mathematical fraction.
Your task is to return the decimal representation of that fraction as a string.
If the decimal part is repeating, you must enclose the repeating digits in parentheses.
If the fraction results in a finite decimal, return it as is (without parentheses).
Notes:
If there are multiple possible correct outputs, any valid one will be accepted.
The result string length will always be less than 10⁴ for all inputs.
Input: numerator = 3, denominator = 4
Output: "0.75"
Input: numerator = 10, denominator = 6
Output: "1.(6)"
Input: numerator = 7, denominator = 2
Output: "3.5"
Accepted:
Submission: