Contizant interview question

A medium coding question without a proper explanation and is different from that which is displayed.