0
c# two dimensional arrays - mode
How would i calculate the mode of a two dimensional array in c#?
1 Odpowiedź
+ 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