16 lines
218 B
Text
16 lines
218 B
Text
mode(v)={
|
|
my(count=1,r=1,b=v[1]);
|
|
v=vecsort(v);
|
|
for(i=2,#v,
|
|
if(v[i]==v[i-1],
|
|
count++
|
|
,
|
|
if(count>r,
|
|
r=count;
|
|
b=v[i-1]
|
|
);
|
|
count=1
|
|
)
|
|
);
|
|
if(count>r,v[#v],b)
|
|
};
|