RedDoorz interview question

How to solve this problem?