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.
Brilliant!
My solution was very memory inefficient. This is great!
Would anyone care to explain this implementation a little bit?
I am not quite sure if I follow along the last three if statements.
Why would x2 bet set to 2 * h[++i]?
same question here
Length of an array is a public final int, so no calculation is done.
see here
http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.7
really?learn it!
That is not true.
i<length
and
i<arr.length
have exactly the same cost.
The difference would be, when comparing to collection size, such as ArrayList and using .size() method, but here it doesn't matter.
for (int i=0; i<arr.length; i++)
Calculate the length in the cycle, is not efficient
int sum = 0;
int length = arr.length;
for (int i=0; i<length; i++) {
sum += (i % 2 == 0) ? arr[i] : arr[i] * arr[i];
}
return sum;
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Much too easy for a 5kyu, at least in Python...
Translated to Java. Please approve when you have the chance :D
Title is not that relevant. It is a good kata, but title needs to be changed to give a better idea of what the kata is about. Try to leave out political opinions.
I actually wrote it out using sumation notation and then simplified down.
Ugh, why didn't I see the pattern when I did this? :(
How much honor is earned for kata translations?
Loading more items...