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.
I solved the kata using a bruteforce approach.
Your solution is good. Using reduce function to get the final state is clever.
Unpublishing because it's a duplicate of other look and say kata (like https://www.codewars.com/kata/53ea07c9247bc3fcaa00084d) with issues not being resolved by the author.
Duplicate of many look-and-say-sequence katas as pointed out below.
there are a lot of look and say katas now, i like the variation of this one!
Already fixed
If use an arrow funcitons it's possbile to create
command.reduce
without adding bind. It going undestandthis
in context ofAutomation
instance.Great Idea to represent states array only by cells where to move. I used
false
to determine situation when there is no move. And this requires condition. This uncunditional apporach really rocks. Thank you.At least in JavaScript: No example tests. No random tests.
I've fixed the example tests, and I've fixed up one of the submit tests (inverted actual and expected). Someone else will have to do random tests and check CoffeeScript tests.
Don't think it's going to be unpublished after two years in beta. Closing the issue.
Because you don't have to test for anything above 1/2 the number... 2 is the lowest divisible number to check for. Saves computing time.
num / 2
? why? do you meansqrt(num)
?Ow :)
I solved this long time ago - can't even remember if I noticed this sentence then.
And there's also that:
But as You mentioned, the code can be easily extended to account for other symbols.
Cheers!
Thanks for the feedback.
"As an aside, the automaton accepts an array of strings, rather than just numbers, or a number represented as a string, because the language an automaton can accept isn't confined to just numbers. An automaton should be able to accept any 'symbol.' "
My English is not very good, does it mean it could accept input like ['1', 2, '3', 'symbol', '$']?
Your solution is still very clever, functional-lang and elegant.
Thanks! Good point. I don't do handle input checking in katas, unless description suggests that the input may be invalid and/or validation is a part of the task - parsers etc.
clever to use reduce. But an invalid input will throw an error, we could check if this.states[state] and this.states[state][input] are valid, if not then return invalid. and define another state for invalid.
Loading more items...