Amdocs interview question

code based on arrays