[Jprogramming] Quora Challenge
Erling Hellenäs
erling at erlinghellenas.se
Sun Sep 17 18:21:07 UTC 2017
It failed on the commented tests, but it's dead fast, yes. /Erling
s=: 10 f 100
s
>./90 91 92 93 94 95 96 = s
NB. s=: 1 f 2
NB. >./s = 1
NB.s=: 2 f 3
NB. 0 = $ s
NB. s=: 8 f 9
NB. >./s = 8 9
s=: 7 f 8
>./s = 8
NB.s=: 10 f 11
NB.>./s = 10
s=: 7 f 11
>./s = 8 9 10
s=: 200 f 300
s
>./0 = 1 p: s
1 = 1 p: _1 + 1 {. s
1 = 1 p: 1 + _1 {. s
s=: 2000 f 3000
s
>./0 = 1 p: s
1 = 1 p: _1 + 1 {. s
1 = 1 p: 1 + _1 {. s
timespacex'2 f 200'
1.36076e_5 4736
timespacex'2 f 2000'
2.53595e_5 22656
timespacex'2 f 20000'
9.46343e_5 166016
timespacex'2 f 200000'
0.00184228 1.3129e6
timespacex'2 f 2000000'
0.0159511 1.04882e7
timespacex'2 f 20000000'
0.133137 8.38885e7
On 2017-09-17 19:58, Raul Miller wrote:
> Oops,
>
> biggap=:{~0 1+[:(i.<./)2-/\]
>
>
> Thanks,
>
>
More information about the Programming
mailing list