What you have done so far ? try something yourself and come with some issue/problem. I am posting here the solution but i will also give you another question and expecting to resolve by you.
Solution for your question :
int startIndex = 0;
int count = 3;
List<int> myResult = new List<int>();
public new List<int> MaxMinFinder(int abc)
int value1 = new int;
value1 = abc.Skip(startIndex).Take(count).Max();
value1 = abc.Skip(startIndex).Take(count).Min();
startIndex += count;
if (startIndex <= abc.Length)
You can use this function to get List<int>(your expected result).
Now whats your homework is,
- Make above class generalize, i do not want any fix value. in above code you can see count = 3
is fix. make it generalize to use anywhere.
Hope you can do this, even this problem is very simpler then yours,