Ad
  • Custom User Avatar

    this solutiion works much faster than first, esecialy for big arrays
    there are benchmarks for 100 000 000 elements

    find_outlier_1
    10.340000 0.270000 10.610000 ( 10.611158)
    find_outlier_2
    1.960000 0.000000 1.960000 ( 1.968448)

    find_outlier_1
    9.890000 0.320000 10.210000 ( 10.219760)
    find_outlier_2
    7.720000 0.000000 7.720000 ( 7.731714)

  • Custom User Avatar

    Definitely better than the "top" answer... and mine too, for that matter :)

  • Default User Avatar

    Completely agree! It's also closer to how a human would work it out manually. For relatively simple tasks like this, the "obvious" approach that omost people would take, tends to be the most optimal too.