Tech Mahindra interview question

Test you on your logical ability