Amazon Interview Question

How would you solve ML question X?