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.
ok...?
This comment is hidden because it contains spoiler information about the solution
Runtime per se won't be a problem here (maybe it is about 0.4ms). The real trouble is, that this ends up in an infinite loop for values above the square closest to INT_MAX.
Hello siebenschlaefer,
is using
a locally allocated char array
which is returned via strdup(charray)
a form of memory leak?
thank you,
rowcased
Yes, this function allocates some memory and the caller is reposible for deallocation. That's common in C programs.
All alternatives either leak memory, cannot handle arbitrarily large results, and/or are not thread safe or reentrant.