Pergunta de entrevista da empresa Cyntexa

Given an integer array arr, remove all elements for which the average of their neighboring elements is greater than the element itself. Return the resulting array after removing such elements.