Tech Mahindra interview question

Deep into theoretical rather than implementing