Ad
  • Default User Avatar

    I'm surpised this isn't the top result, it's the fastest solution I've found:

    1.58 µs ± 13.9 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

    vs the top solution (in best practices):

    1.83 µs ± 23.9 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)