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.
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.
i did something similar but using log10(x)+1 to get the digit amount, now I feel dumb for not thinking of this
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).excellent
NB!
Many thanks!
Loading more items...