changed the variable idx value from i to the last index of resultGroupsList
List<int> resultGroupsList = new List<int>();
for (int i = 0; i < count; i++)
{
int idx = i;
int idx = resultGroupsList.Count - 1;
while (i < count - 1 && conditionUsages[i].Operator == Operator.And)
i++;