Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import std.stdio, std.algorithm, std.array;
|
||||
|
||||
auto mode(T)(T[] items) /*pure nothrow*/ {
|
||||
auto mode(T)(T[] items) pure /*nothrow @safe*/ {
|
||||
int[T] aa;
|
||||
foreach (item; items)
|
||||
aa[item]++;
|
||||
|
|
@ -8,7 +8,7 @@ auto mode(T)(T[] items) /*pure nothrow*/ {
|
|||
return aa.byKey.filter!(k => aa[k] == m);
|
||||
}
|
||||
|
||||
void main() {
|
||||
void main() /*@safe*/ {
|
||||
auto data = [1, 2, 3, 1, 2, 4, 2, 5, 3, 3, 1, 3, 6];
|
||||
writeln("Mode: ", data.mode);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue