## Eatclub Interview Question for Consultants

Country: United States

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````static void ReGroup(List<int> Numbers)
{
int groupCount = 0;
int groups = Numbers.Count / 3;
for (int i = 0; i != groups; i++)
{
int secOne = Numbers[groupCount];
groupCount++;
int secTwo = Numbers[groupCount];
groupCount++;
int secTree = Numbers[groupCount];
groupCount++;

int currnet = groupCount - 1;
Console.WriteLine(currnet);

Numbers[currnet] = secOne;
currnet--;
Numbers[currnet] = secTwo;
currnet--;
Numbers[currnet] = secTree;

}

}``````

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````void reverseArrSect(int iArr[n],int iSec)
{
int iTemp = -1;
cout << endl << "reverse sections of array";
for(int i=0;i<n;i+=iSec)
{
iTemp =  iArr[i];
iArr[i] = iArr[i+2];
iArr[i+2] = iTemp;
cout << iArr[i] <<','<< iArr[i+1] << ','<<iArr[i+2] << ',';
}
}``````

Comment hidden because of low score. Click to expand.
0

the solutions does not handle the situation when last section is not full, i.e. contains 1 or 2 elements.

Comment hidden because of low score. Click to expand.
0
of 0 vote

Very easy program. Written in c#

``````private static void ReverseArray() {
// in C#, given a list of numbers [4,8,20,11,12,18,50,10,11] and divided in sections of 3
// Reverse each section without using another array
int[] array = { 4,8,20,11,12,18,50,10,11 };

Console.WriteLine("Original array");
for(int i=0;i<array.Length;i++) {
Console.Write("{0} ", array[i]);
}

// Traverse the array stepping by 3
for (int i=0; i<array.Length; i+=3) {
// Just I need to swap first and third
int temp = array[i];
array[i] = array[i+2];
array[i+2] = temp;
}

Console.WriteLine("Reversed");
for(int i=0;i<array.Length;i++) {
Console.Write("{0} ", array[i]);
}

}``````

Comment hidden because of low score. Click to expand.
0

if the array length is even then exception will occur

Comment hidden because of low score. Click to expand.
0

if the array length is even, then exception will occur

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.