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.
My lift doors won't open unless the lift has arrived at the floor, so there is no way to push people down shafts. Maybe try pushing them down stairs, or through a window.
headdesk
*Every* *single* example I try works fine, but some random test gets me, or maybe a "tricky" one. But that's the key, maybe.
Pro tip: Reset your variables on each pass. I wrote this as a
class
first, noticed it was expectingstatic
, shrugged and threw static in front of everything. Who cares, nobody is going to create multiple objects anyway since the kata only calls a static method.Well, turns out I care since I'm using the static constructor.
Roll back to my first Git commit, toss ^^^ in, and it passes!
Still my fault, clearing variables is Programming for n00bs 101, but I guess I'm finally thinking in objects now...
I did decide to leave in some of the extra edgecase handling that I wrote while trying to figure out where I was going wrong, I'll leave you with this one:
Although the Kata doesn't require it, I highly recommend it.
Right? Parsing back to front and then back to the back just hurts my brain. Fun though, would solve again.
This comment is hidden because it contains spoiler information about the solution
In the real world, I believe a human could figure it out based on the permutations that make up a more or less valid message compared to the others. For example, if my cat learned Morse code but wasn't great at timing, the message "FEED ME" would be more likely than "FE ED ME" due to its simplicity. However, the code itself cannot understand the context. And my cat is almost 18, cut him some slack.
If we were guaranteed that all words belonged to a provided dictionary, it might be possible to solve this issue. However, as far as I can tell, we're stuck hoping that we have made the same assumptions as the test authors. Alternatively, we could dump their tests into exception messages to see what they're feeding and start special-handling the ambiguity as we go. It's impossible to solve an ambiguous problem unambiguously, and I'm not seeing that this one is fully defined.
Maybe that's just me and I'm just not clever enough, which is a very real possibility too.