Problem
Ask
Submissions

Problem: Fraction to Recurring Decimal

Medium
30 min
Understand how to convert integer fractions into their decimal string representations, including detecting and enclosing recurring parts using hash maps. This lesson guides you through implementing the solution efficiently while grasping the underlying problem logic.

Statement

Given the two integer values of a fraction, numerator and denominator, implement a function that returns the fraction in string format. If the fractional part repeats, enclose the repeating part in parentheses.

Constraints:

  • denominator !=0!= 0
  • 105-10^{5} \leq numerator, denominator 1051\leq 10^{5} - 1
Problem
Ask
Submissions

Problem: Fraction to Recurring Decimal

Medium
30 min
Understand how to convert integer fractions into their decimal string representations, including detecting and enclosing recurring parts using hash maps. This lesson guides you through implementing the solution efficiently while grasping the underlying problem logic.

Statement

Given the two integer values of a fraction, numerator and denominator, implement a function that returns the fraction in string format. If the fractional part repeats, enclose the repeating part in parentheses.

Constraints:

  • denominator !=0!= 0
  • 105-10^{5} \leq numerator, denominator 1051\leq 10^{5} - 1