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.
Going for 2000 was a good idea, my brute-force solutions in Java didn't work :'D
Amazing kata, thank you very much!
This comment is hidden because it contains spoiler information about the solution
I think you might be underestimating the power of memcpy :D
Fully agree with this :'D
Agreed. It's not too bad since vectors are cleverly resized under the hood. But you are right, it would be an improvement. Calling the constructor with the size would also be an option. While doing that you could also store the size in a variable and use that for the loop. That should be more efficient, since the compiler probably can't infer that lines.size() is a constant
Yippie! Thank you for all the help! ^.^
approved 🦊
Ouh I see :'D
Should be clear now, I just had to remove the function "hint" for C.
Here is the new fork: https://www.codewars.com/kumite/60d98f1d57c9d500554dff6b?sel=6276990271e24f0016c113cd
there is a merge conflict because the the kata's description has been modified since the time you started this translation. you need to fork this kumite so that the description is updated; and publish the new fork. let me know if it's clear ^^
Very nice, thank you for the feedback!
Dang it, I completely forgot about that. Glad you mentioned it ^^'
Should be fixed now!
num_elements
imo, now that it is used as a length hint for the arraystatic
. This avoids the user calling your reference solution or trying to manipulate the random numbers generator; and it's also good practice to avoid namespace pollution.Hey there ^^
Thank you very much for taking the time to give some really nice feedback! I greatly appreciate it.
I think that I included all of your suggestions. I, unfortunately, didn't have the time to print the pyramids. In the case of the sample tests they are visible, but for the "more elaborate" tests it might be worth to add them (for the smaller ones). Let me know what you think, then I'll take some time :D
Oh and regarding the suggestion with the
num_elements
, the C99 style seemed like a good idea to me. I didn't want to "burden" people with figuring out that you can use gauss to "derive" the number of elements fromrows
. My reasoning was that other languages (afaik) did not require that, but let me know what you think!Cheers ^^
This comment is hidden because it contains spoiler information about the solution
no feedback on failure: you have to ovveride the default assertion message like so:
cr_assert_eq(actual, expected, "expected %d but got %d", expected, actual);
You could also (optionally) print pyramids when they are not too huge
=> more tersely :
Could you use C99 parameter declarations and change
to
? either that or get rid of
num_elements
, as it is not strictly necessary to solve the task, and unused parameters trigger warnings, except when they are length hints for other parameters1 sample test is too little. I would add a couple, including an edge case where the pyramid has only 1 row
the initial solution setup does not clearly explain the memory model of
pyramid
, especially considering most other languages use 2D arrays. I suggest a message along the lines of :Cheers :)
Loading more items...