Expedia Group Interview Question

How to implement greatest common denominator.