Practice Equal Rational Numbers
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
Given s and t representing nonnegative rational numbers, return whether their values are equal. A representation may be an integer alone, an integer followed by a decimal point and a possibly empty nonrepeating part, or that decimal form followed by a nonempty repeating part in parentheses. The parenthesized digits repeat forever. Compare the represented numbers rather than their spellings; repeating 9s may represent a terminating value.
Source: Equal Rational Numbers on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "0.(52)", t = "0.5(25)"
true
# Example 2
s = "0.1666(6)", t = "0.166(66)"
true
# Example 3
s = "0.9(9)", t = "1."
true
Constraints
Related LeetCode Problems
Practice more problems similar to Equal Rational Numbers.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.