Philips interview question

Some coding concepts