Google Interview Question

How to solve mathematical problem