Quant Memo
Coding/●●●●●

Group fractions that are equal

Given a list of fractions as (numerator, denominator) pairs (denominators nonzero), group together all fractions that represent the same value.

fracs = [(1, 2), (2, 4), (3, 6), (1, 3), (2, 6)]
-> [[(1, 2), (2, 4), (3, 6)], [(1, 3), (2, 6)]]

Return the groups. Do not compare every pair.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions