Capco interview question

Sort an array. Remove elements from the array. Avoid null pointers.