Lenovo interview question

Give solution to a case