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
I disagree. If you use one counter clang can't vectorize your code automatically using SIMD.
Mate, this is elegant. Good job!
WTF
nice job using only one counter instead of two.
This comment is hidden because it contains spoiler information about the solution
i sreached it and it very smart way to do it . nice one
My first solution to C++ kata that is the same as any other solution <3
Lol nice, had no idea this existed.
This comment is hidden because it contains spoiler information about the solution
std::map is actually O(logn) to find. A hashmap (std::unordered_map) would be what to use for efficiency
very inefficient space-wise.
You are genius!
ascii size is known(128), so u can get the occur-times and put them at their natural-locations in a vector, so that getting the occur-times data for every character only takes constant-level of time.
I'm not an expert but, IIUC, there are more efficient solutions here. This one is O(n log n) due to sorting. But there are some that use either
std::map
or vectors to keep counts of each letter in each string. Those should be O(n).Loading more items...