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.
I've been thinking about it too
you used an extra variable
r
in your code for the same purpose, only it was a pointer instead of an indexThe kata was approved overnight when I do not have an access to my laptop.
However, I would like to ask you, what do you mean by
in C, the "value = 2" in description is never used
? The original task was made in Python and the author of the C translation did not change the description, stating that the description to the katas should be language-agnostic.About the definition of what "trace" is, I agree. By marking this task as "beginner-friendly", I should have stated the key things.
TIL on Wikipedia:
Indeed, it would be good to add this term & link to the description, as so many other katas also do.
indeed, iBits+2 instead of n+2... but i dunno why i even did a malloc instead of just a fixed sizeof(int)*8+2 byte array or something...
cuz it looks beautiful!
looks elegant but inefficient indeed.
Your array without
-199
:Your array without
196
:q is obviously smaller when removing 196. I have no idea why your excel is giving you the wrong numbers. It's entirely possible that your implementation in excel is incorrect, or maybe excel is running into some kind of overflow error. Your values of q are obviously incorrect, though. You are dividing the product of the array by the sum of the array, with very few exceptions (and this array does not fit any of the exception criteria) this will produce a q value greater than 1, but your q values are very close to 0, and you can manually do the sums and products yourself to see that the q values you should be producing for this particular array should be very large, and so your q values are far from correct.
After looking at your code, you may want to pay attention to the data type that you use to hold your product total values keeping in mind that the product total will be very very large in some cases like the above example.
This comment is hidden because it contains spoiler information about the solution
my passing python solution says 196 and also what you say isn't reasonable after reading the instructions
good tip.
i < res.size()
so only initialized elements are accessed.This comment is hidden because it contains spoiler information about the solution
Me too! It is so long since I wrote this.
The
return *sz, ret;
is really same as justreturn ret;
but I think I was trying to emphasise that thesz
is also a "returned" value. Probably it was unnecessarily clever (?) and caused more confusion than anything else.I believe he meant "Cd
W
r oeas", but he made a typo.Loading more items...