c# two dimensional arrays - mode | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

c# two dimensional arrays - mode

How would i calculate the mode of a two dimensional array in c#?

26th Mar 2020, 11:44 AM
Oithere.py
1 Answer
+ 1
I guess you talk about mode known from statistics... https://en.m.wikipedia.org/wiki/Mode_(statistics) You can use Linq to do so. I grouped by value and then by frequency to take the most frequent groups. Important to know is, that most Enumerable extensions won't work by default on 2D arrays, so you need a workaround like using Cast() first. https://code.sololearn.com/cM1iLVcO9T95/?ref=app
24th Apr 2020, 10:17 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar