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.
Maybe that was a joke only :)
This comment is hidden because it contains spoiler information about the solution
I do know regex :) What I didn't know was how to manage gsub with it and it is actually more difficult to read what is considered the top answer.
The
copy
allocates heap space (strdup) which I want to free to avoid leakage, and so doesarr
(malloc), butchar *p
is just a pointer.Not if the word chars are set to uniq before starting the count loop :)
Exactly..that is a good practice!
wow, ur a genius!
That may be better for more expensive calculations, but the beauty of this design is that it mostly doesn't matter. That change could be entirely internal to the class, with no change to the external interface. So... we don't have to make any decision about it until we've tested the performance.