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 noticed that an edge case is only (occasionally) covered by the java random tests. I would suggest adding this test case:
{{0,1,0,0,0,0,0,0,0,0}, {0,0,0,0,1,1,1,0,0,1}, {0,0,0,0,0,0,0,1,0,1}, {1,0,0,1,0,0,0,1,0,1}, {0,0,0,0,0,0,0,0,0,1}, {0,0,0,0,0,0,1,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {1,1,0,0,0,0,1,1,0,0}, {0,0,0,0,0,0,0,0,0,0}, {1,1,1,0,0,0,0,0,0,0}}
This comment is hidden because it contains spoiler information about the solution
I especially liked tinkering with the simplifications. You could play with that forever...
So I left out the simplifications like (+ 1 (+ 2 x)) -> (+ 3 x) and (* 2 (* 3 x)) -> (* 6 x) because the tests seem to accept both.
Very happy with my solution, although it is a 'bit' longer than the most upvoted ones (hopefully I compensated with readability)...
It's perfectly valid? It spells '. ..' which translates to 'EI'
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Can't decide if my interpreter is overdesigned for the language or if the language is underfeatured for my interpreter... Probably the former ^_^'
Slightly disappointed that the Oxford Comma is not accepted
The random strings tests are borked - it expects nonempty results for clearly invalid expressions (eg. a trailing | ).
The solution is to just repeatedly attempt until the random strings pass... So I don't really see the point of these random string tests?
I was not amused by the ambiguity of eg. "pop a and b, and push b / a"... is a the top of the stack, and b the one below that, or vice versa?!
The programming effort isn't that hard but I hate how poorly this task is specified :(
@snmzcm to answer your 'question' - you've made a slight logical mistake (or perhaps you misread).
If A ends with B, then yes, that implies A also contains B. However, the converse is generally NOT true: if A contains B, A does NOT necessarily end with B.
The kata specifically asks to determine if A ends with B, so only testing whether A contains B is simply not sufficient.
This comment is hidden because it contains spoiler information about the solution