Remove isolated elements of a vector Languages

Remove isolated elements of a vector

I have a vector of integers and I want to filter it by eliminating the components that are "isolated". What do I mean by "isolated"? those components that does not lie in an 4-neighbourhood of other component. The components in the vector are ordered increasingly, and there are no repetitions.
Read More