Skip to content

Latest commit

 

History

History

291-fractionMath

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

fractionMath

Interview question of the issue #291 of rendezvous with cassidoo.

The Question

Write a function that can do the 4 basic operations (add, subtract, multiply and divide) on two fractions. Return the most simplified form of the result. You can assume a non-zero denominator in the input, and don’t use any built-in implementations in your language of choice, if you can!

Example:

> fractionMath("3/4", "add", "3/4")
> "3/2"

> fractionMath("1/8", "multiply", "2/2")
> "1/8"

Installing & Running

Just pnpm i to install all dependencies and then pnpm t to run the tests!