Given:
var arr = new int[] {
10, 20, 30,
10, 20, 30, 40, 50,
10, 20
};
Wanted:
var group1 = new int [] { 10, 20, 30 };
var group2 = new int [] { 10, 20, 30, 40, 50 };
var group3 = new int [] { 10, 20 };
Need to group by value => when next element's value is lower than the previous one, create new group. Would appreciate LINQ-based solution.