Tech Mahindra interview question

Nothing difficult as such.