Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Apparently the solution is "keep attempting until the server decides to run your code 1ms faster."
Maybe I could have gotten a little more speed by using bitshifts instead of division, but I doubt that would make the difference... If that even applies in something as high level as JS.
Fixed.
C translation (author gone)
Oh so I checked and it seems that my edits are not the reason for the error. But it needs to be fixed anyway, I will take care of this.
Oh that's because I removed one character from the alphabet and didnt adjust the sampling function. I will fix this.
Sorry for the problem.
(OP is talking about JavaScript)
I can confirm the issue, there is an off-by-one error in the RNG:
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This is my fault. I forgot that parseInt takes a second parameter which completely changes the behavior. It should be fixed now.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
A'ight, this kata has me thrown for a loop. There are some tests that appear that yield one result on the master test, but seem as though they should fail the problem as described. It seems to come down to how Array.prototype.some behaves when handed parseInt?
For example, one generated test:
seq = [
'JDQIAXYXUNBLWRAJSFXT',
'D',
'WCPXZDEGMLCRZ',
'UYJMHZ',
'XBIHTBFUBBNZLOXRGFFABJKJFPI',
'TCNIIHVBFLOVXYG',
'PNPOTCZUPVFVWGTL',
'Z',
'XGINIHEGSOEYMRASCEKRZ',
'',
'',
'JDMJVCRJUGMXWN',
'PMIJJEJKMIBB',
'FXU',
'PYPSHQLTROEUN',
'KICOX',
'GERISTWQWDGAFERQIIFXVGJ',
'YWLJCSNAMZGLOXJLNLGHKVNDTEPY',
'CQLIUPVRSMVTHQSCJJC',
'XWBQHOSFAFI',
'FA',
'BIMKRIOHZCAG',
'BMDBPDDHONJOAOVUIWHGFDO',
'CMWFHNYFQQNWPBNNKSCDFDIRB',
'AGCWIZYRHQCGQPYEGKIES',
'TRAGUVGYJ',
'LSJSLBF',
'BLIQUGELZDQ',
'AHOORDONNUQBYDDVI',
'EDU',
'SVALRMLJGV',
'DFFLUMEJHIP',
'YNUUEJN',
'CNTYKGQRFWLHTB',
'YO',
'EFMVKHWLVMEJSZWW',
'QKDWFTLQFBBCDUUAOIAV',
'XBWSBFBAZIPPBWBJYTT',
'',
'SONQBBCCBBDMGD',
'PYNLTD',
'JUTSGTDJUZPFNCXJHICNWMH',
'',
'DC',
'CUZST',
'KSGPQILMASPYLDRSDJNCAI',
'SKPYFUXQYLUQFDZYE',
'LOZQUNTQMSGRR',
'TBWPDTYBMLJSMVFPWNKNAQHMKUA',
'AENVOGUUJNJRYHSQVFZ',
'GIJRVCRRHGNDQWTXOGCA',
'YZNO',
'SCPMMBOFEFTIRAAKNBSH',
'CPQNNP'
]
pred = parseInt
And the output of using this sequence is:
seq.every(parseInt) == false
seq.some(parseInt) == true
seq.some(x=>parseInt(x)) == false
So a solution that runs
seq.some(pred)
will get a different result than one that runsseq.some(x=>pred(x))
or something to the effect oflet trueSeen = false;
for(const x of seq) if(pred(x)) trueSeen=true;
return trueSeen
will also return false.
Just at a glance, I'd expect false (every one of those strings yields NaN), yet the built in tools yield true.
Can anyone tell me what I'm missing?
This comment is hidden because it contains spoiler information about the solution
hahaha, bro took the role of god to a whole new level
This comment is hidden because it contains spoiler information about the solution