Siam Computing interview question

I had written test and face to face discussion.