CVS Health Interview Question

Asked to perform some operations on List