Practice Fraction to Recurring Decimal
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Convert numerator divided by denominator to a decimal string, including a minus sign when needed. If the expansion terminates, return its finite form. Otherwise enclose the repeating part of the fractional digits in parentheses; any valid representation is accepted. The resulting string is guaranteed to have fewer than 10^4 characters.
Source: Fraction to Recurring Decimal on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
numerator = 1, denominator = 2
"0.5"
# Example 2
numerator = 2, denominator = 1
"2"
# Example 3
numerator = 4, denominator = 333
"0.(012)"
Constraints
Related LeetCode Problems
Practice more problems similar to Fraction to Recurring Decimal.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.