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.
Right, I had a mistake in my code. Using an O(N) lookup for the characters is easy but inefficient; my O(1) attempt was incorrect because the alphabet is not necessarily ordered. However, you can write the code to have O(1) search if you're careful and take unicode into account.
I had no problems with Unicode in Python at all... Worked like a charm.
Thanks for the followup. Character order is definitely one of those things that can be highly dependent on locale, so the original tests were designed to make order ambiguous for some test cases. The Unicode tests don't even use the full Japanese syllabaries.
If you're working on a highly local solution -- it might make sense to use the ord function for performance reasons. General purpose computations, on the other hand, rely on the essence of the symbols themselves rather than their semi-arbitrary representations. The scope of what anyone can represent in a binary system is very impressive. ASCII and Unicode are one way, but there are also plenty of other character sets based on other systems.
Also, flagged your response as a spoiler.
This comment is hidden because it contains spoiler information about the solution
I'm a bit of a Python newbie so I don't know the particulars of Unicode in Python. I'm still glad someone else provided a Python interpretation in addition to my Javascript interpretation. The general concept is to replace a single character with another. In Unicode, a single character can be represented by multiple bytes, so you need to ensure that whatever functionality you're using will interpret a pure unicode character rather than a single byte. Historically, many string functions have looked at single-byte characters rather than multi-byte characters. I know this is beating around the bush, but hopefully it will help you find the right direction.
This is really difficult to do with Python because of the unicode test case. My code works on all other test cases.
Any tips for solving this in Python when not-ASCII unicode strings are used?