Subex interview question

Logics of different programs.