Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _08.Majorant
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = new int[] { 2, 3, 2, 3, 2, 3, 4, 3, 3 };
- int occurs = (array.Length / 2) + 1;
- for (int i = 0; i < array.Length; i++)
- {
- if (array.ToList().FindAll(x => x == array[i]).Count >= occurs)
- {
- Console.WriteLine(array[i]);
- return;
- }
- }
- Console.WriteLine("doesnt exist");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment