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.
set is like a fun that if any elem is repeated it will del it so he will ran the loop 2 times not like 10 or something and it can be more than 2 but cuz there is just 2 kine of numbers in the same list it will get 2 and the repeated one will get del
This was the most satisfying kata i have solved in a while, never thought i would learn MORSE. Kudos! dude.
Reversed
isn't repeated in a row, they're far apart, so that doesn't count. See this example:in js random tests, can you explain why "Super BytEs rEVErSEd priNt divmoD reVersEd nexT next OCt OcT oct asCIi COmPlEx" expects 2 while repeated words are [ 'reversed', 'next', 'oct' ]
That's the concept of recursion.
As you grow, you'll get to use it more often
Never ever thought about calling the same function within the function, awesome.
I love this solution dude, well done.
Dude you juat blew my mind, elegant af.
Nope, on the contrary, the tests are lacking such cases. The issue you've raised above is another example of where a wrong solution would try to parse
\w+\d+
as a word.Expected:
instead got:
The difference: your solution considers
TNgtVbuGSaQrYFpHXkqhmseidfjwUMKPcEvlRnoLOWZDJCBI135 pounds
a valid expression and replaces it withNaN grams
. There is no word boundary or space between numbers 135, so it shouldn't be considered at all.Ah, I see... Definitely needs to be mentioned in description, or even better, reconsidered and not generated like that at all.
formally, without the whitspace, that's not
ounces
but a ""word"" beginning with ounces. So no replacements. But that looks weird with this formatting, yes.Or just compute the expected value before the actual value. It's easier that way.
What Voile meant was that you're passing references of actual randomQuestions arrays (to random tests), and NOT their copies ( = what you should be doing). You can clone an array by simply passing
randomTest( arr.slice() )
instead of justrandomTest( arr )
, this way user cannot modify the original array.input:
[ '77 ouncesBSdGPWfMQaUCNXcHRDTLnemKOjJhFZEbAgikIYlV (MALUBGISOKCbNcdaEPHeJZTRQXWFVDY) ', ...]
(random test)Expected:
['77 ouncesBSdGPWfMQaUCNXcHRDTLnemKOjJhFZEbAgikIYlV', ...]
Why not:
[2182 gramsBSdGPWfMQaUCNXcHRDTLnemKOjJhFZEbAgikIYlV', ...]
?Also I see cases where x tablespoons remains the same in expected output.
Loading more items...