Solution to Leetcode problem 972 Equal Rational Numbers

Pierre-Marie Poitevin
3 min readJan 9, 2019

In this problem, the authors introduce a common notation for rational numbers (with repeating decimals) and invite us to find out if two notations have the same value.

Leetcode 972 problem statement

The solution to this type of problem is often to find a canonical way of representing the class of numbers that are equivalent. For instance, I know that 2/4 and 3/6 have the same value by reducing the…

--

--