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.
🤣🤣 Brute force FTW!
I think you use too complicated ternar operators. It is difficult to read and understand logic.
OK, got it. I was running into an unexpected "feature" of reduce that I was unaware of.
Inelegantly solved. Thanks for your help.
I thought it would count as an issue as it was giving an error message rather than simply telling me that the code failed a test. I don't get this error message in the REPL on my own machine so it seems to be particular to the site. But I take your point!
I doubt that the reduce function is the issue, given that it passes all the random tests, but I'll try and alternative solution so see if that works better. Out of interest, how many tests are there under the
should work for some examples
section? I see four passing tests, then an error message, then all the random tests passing. Is it failing on the fifth test maybe?First: when you are not sure if the problem comes from your code or from the kata, please post a question not an issue:-)
Second: nobody else than I passed the F# translation. All I can say is that I pass the tests... Morever I use nowhere "reduce". So it could be your code when you use "reduce" in your function "convertFracts".
Cheers.
I'm trying to do this kata in F#. My code passes the sample tests and all the random tests but it gives the following cryptic error message when doing the first part of the automated tests:
I can't tell from this if there is a problem with my code (an edge case I've not considered) or if there's a problem with the tests themselves. Can someone please clarify this?
Now that is a list of prime numbers !
Tests are locked anyway so nothing can be changed
That is true but the only difference it would make in most of these solutions would be a conditional to check if the element being iterated on contains non-characters,
in which case a simple regex would solve the problem. So I wouldn't consider it that big of an issue.
Fixed, they're now all
1e-10
.why you think [ 1, 2, 3, 5, 6, 7, 88, 4455, 9927446 ] is incorrect?
Modified. Top-answer and second-from-top don't pass anymore. Nevertheless they are not invalidated?!
Edit: now they are.
Note to author:
JS version still has under 500 solves so it's possible to edit the tests. ;-)
The tests for JavaScript are incomplete and are accepting incorrect submissions. For example, if we try to calculate
decompose (9927447)
, the second-from-top submission returns the incorrect answer[ 1, 2, 3, 5, 6, 7, 88, 4455, 9927446 ]
, the third returns the correct answer[ 1, 3, 17, 87, 4455, 9927446 ]
, while the top answer causes a stack overflow!I only discovered this after my incorrect algorithm was accepted, but the R version failed the unit tests.
Fixed.
Loading more items...