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
OP solved it, closing
OP solved it , closing
You shoul calculate percent/100 before while. And you might add +1. i.e. percent = percent/100 + 1. Cause x + x*0.1 = x.1.1
This comment is hidden because it contains spoiler information about the solution
One small performance change. I would calculate "percent / 100D" before the while loop in order to prevent the slight extra work added for each pass. The rest is much cleaner than mine :)
From the perspective of the code that calls the method it doesn't matter at all, in Java parameters are always passed by value. Whether method code should be allowed to reassign parameter variables or not is primarily opinion based or just a matter of taste. With short code like this I personally don't see more disadvantages when modifying p0 compared to declaring another variable which might be considered additional noise. And with rather long or complex method code you have a different problem anyway: You're unable to quickly understand what it does anyway.
Quite lengthy code but that is how you actually should do it when not going for Java 8.
I made the modifications (the java version was really a mess!) and republished it, but the previous soluitons aren't invalidated yet... I don't know if this is just the server which is not up to date or if my modifications won't actually get realmy published because there are already too much completions to the kata... Let's see it in the next days...
Java: Basically same for me. Can some admin have look into this? Seems like there is an issue with Submit tests. Unfortunate to see it not corrected for such a long time.
Some of us are at a level where that is a lot to explain; so thank you for replying to their question.
Magic! :]
But seriously, sloppiness.
There isn't much to explain. How would you calculate
fusc(5)
? Well, 5 = 2 x 2 + 1, andfusc(2 x 2 + 1) = fusc(2) + fusc(3)
.fusc(3) = fusc(2 x 1 + 1) = fusc(1) + fusc(2)
.fusc(2) = fusc(2 x 1) = fusc(1) = 1
. Put these results together and you getfusc(5) = 3
. Your job is to implement the function fusc.I too would like more directions on what this kata is even asking. So I'll just throw this comment in to draw more attention it it!
This comment is hidden because it contains spoiler information about the solution
Loading more items...