Dictionary<string, int> counter = new Dictionary<string, int>();
            foreach (string c in  数组)
            {
                if (counter.ContainsKey(c))
                {
                    counter[c]++;
                }
                else
                {
                    counter.Add(c, 1);
                }
                if (counter[max] < counter[c])
                    max = c;
            }

max为元素    counter[max]出现次数最多的元素出现的次数

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2021-08-27
  • 2021-09-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-12-09
  • 2022-12-23
相关资源
相似解决方案