Scott Logic interview question

Three bucket problem