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.
This comment is hidden because it contains spoiler information about the solution
your two questions have the same answer: you added logs to
encode(), but not todecode(). Your code correctly encodes"カタカナ"to"タモタワ", but then fails to decode the latter.can't get much better than your single pass solution, so the only change here is using a smaller type for the value of the map. makes it not readable though.
An interesting problem :)
This comment is hidden because it contains spoiler information about the solution
great work
kata was retired
kata was retired
kata was retired
( Python, possibly C++ as well )
Two random tests is a bit stingy. Run 100 tests in a loop ( and factor out the random generator ).
( Python, possibly C++ as well )
Passing tests should not print to the console. Show inputs for failing tests in the failure message.
In Python, the example return values look like a set instead of a list ( except for having multiple identical values, which is weird ). For a 7kyu, showing correct examples instead of something from another language seems worth it ( because they're code blocks, and code blocks can have language-specific content quite easily ).
Other opinions may be available; people might say the description should be language-agnostic, but I think the trade-off is worth it here.
In such case i would say that this is not really apparent from the description, at least to me. As far as I see, all examples present in the description show cases which can be simplified in a "stack way", just like in the original challenge?
Yeah, the core logic is the same (cancelling opposite directions) but this version is simpler to reason about and implement.
In the original Directions Reduction kata, not all paths could be reduced (e.g. ["NORTH", "WEST", "SOUTH", "EAST"] had to stay as-is because none of the adjacent directions were opposites). However, in cases like ["NORTH", "EAST", "WEST", "SOUTH"], the original required handling reductions that happen after intermediate pairs cancel out — this version skips that complexity. Also while solving it I had problems with keeping the order of directions intact (I wasn't familiar with stacks and I was implementing a totally different approach), here those constraints are removed, so it’s more straightforward.
Added a test to both the Python and C++ versions to validate this. It should also be covered by the random tests in most cases. Thanks.
Loading more items...