Amdocs Interview Question

code based on arrays