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
Feeling not so good right now haha. Just insane!
I just passed this in C and I'm socked at how bad my solution was. It was just a complete over complication of a very simple math related question. I really need to improve my math intuition on questions like these. Thanks for this great kata!
Ok, I will look into it. Thanks so much for the help!
This might help streamline your code:
The input will be a lowercase string with no spaces.
I'd malloc the strings thus:(stringLen + 1) * sizeof(char)
. Nonetheless, this code would work if you handle your C-strings correctly.This comment is hidden because it contains spoiler information about the solution
can't tell exactly without seeing your code, but my bet is on whether you allocated memory correctly. you may post your code with proper markdown and a spoiler tag, and I can take a look for you.
I hope to ask someone for help with this problem. I implemented a solution in C but during the random tests, one or more of the tests fail. Looking into my solution I'm very sure that the code is solving the problem correctly. Here are some results from my code, using random inputs of my own:
What am I missing? Thanks!
No need to apologize :-)
Vernon, it wasn't a criticism, just was curious as to why you chose to do it that way. My apologies if it came out as insulting. :(
Thank you very much for the information. I'm new to Java and am still learning. You are correct I'm really not sure why I did this but now after reading your comment I can see how stupid it was. Thanks once again.
Why are you doing it this way? You know under the covers that ArrayList essentially has to re copy when it allocates more space when the underlying array runs out of space right? Which is O(n) + NLog(n);
Then additionally you're going to call toArray, which is going to do another scan of the full size, so your time complexity will be O(2n) + n(log(n)) and your space complexity will be O(2n) one for the arraylist and one for the array...
Good example of return statements and codeflow for bigginers. I Like :-)