The method gets a list and should remove all occurrences of the largest and smallest element and return the remaining elements in the o