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.
Just so you know, on a short string ("Success") this solution executes in 49 ns, and your solution in 189 ns.
Asymptotic complexity is not so relevant with short inputs.
This comment is hidden because it contains spoiler information about the solution
interesting that it uses bitmasks yet is still really inefficient
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Bro, I don't like to use ChatGPT for code. Out of interest, I just asked it to solve this task, and it produced the naive solution that Nicolas proposed below.
It would be O(n log n). This solution is O(n).
Папич?
You can check out the fork that doesn't assume a specific
encode_utf8
implementation and that favors ASCII input.it's 10 times faster than the most popular solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...