Sales by Match

  • + 0 comments

    My asnwer C#

     int pairs = 0;
            ar.Sort();
    
            for (int i = 0; i < n - 1; i++)
            {
                if (ar[i] == ar[i + 1])
                {
                    pairs++;
                    i++;
                }
            }
    
            return pairs;