Tech Mahindra interview question

Array functions