I have seven words in the array:
string[7] = {x,x,x,x,x,x,x};
the x is generated from another array:
string[4]={a,b,c,d};
that means each x can be either a or b or c or d. It is randomly generated. this could be an example:
string[7]= {a,a,d,a,a,c,a}
my question is how can I check if there are five x which has the same value?
This is for a poker app Im working on.
Navigate to the "Home" option and select duplicate values in the toolbar. Next, navigate to Conditional Formatting in Excel Option. A new window will appear on the screen with options to select "Duplicate" and "Unique" values. You can compare the two columns with matching values or unique values.
Comparing numbers in math is defined as a process or method in which one can determine whether a number is smaller, greater, or equal to another number according to their values. The symbols used for comparing numbers are “ ”, which means “greater than”; “ ”, which means “less than”; and “=”, which means “equal to”.
You can use Linq to find the largest number of equal items and test if this is 5 or more:
int maxCount = s.GroupBy(x => x).Select(x => x.Count()).Max();
You can do it like this:
List<string> values = new List<string> {"a", "a", "d","a", "a", "c", "a"};
int count = values.FindAll(id => id == "a").Count();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With