Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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?