Imagine what you have int[] data = new int [] { 1, 2, 1, 1, 3, 2 }
I need a sub-array only with those that match the condition data[i] > data[i-1] && data[i] > data[i + 1]... i.e. I need all the elements that are tied to their nearest neighbors.
From the above example, I should get { 2, 3 }
Can this be done in LINQ?
thank
source
share