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.
Iterating by the multiple, rather than using mod on every number (like I did), is an interesting way to go about it. I like it!
What about the case when h < window?
The h is higher than 0 so it will pass the first condition, but the mother will never see the ball falling from the window, and in this case result should be 0 and not 1
they join the elements in the array without spaces
if you wanted to join all the elements with commas between them you'd use .join(', ')
Perhaps I'm to picky here: like most of the solutions You reformulate the conditions, i.e. You calculate the negations somewhere, in Your head or a sheet of paper and test for these calculated conditions - which in this case is easy enough. In general I don't think that this is advisable: it is prone to error, and everybody maintaining your code has to do these calculations in order to check if they are equivalent to those in the specification. I think it is better to test for !(h>0) as specified, instead of testing for (h<=0).
Can't believe I forgot do while... doh! Love the solution starting at -1 count too.
Number of bouncing can be even. What if after first bounce the height of the ball become equal window?
Example:
h1 = x (x > window)
h2 = y (y == window) (h2 = h1 * bounce)
So, the result in such case should be be 2!
In spite of this your solution a realy greate!
Which language?
what if h is slightly bigger than windows, so the ball will not be able to bounce up, you still add +2 to result?
The ones that invoke the map method?
What does the parentheses do in front of the join ?
That's pretty sweet :)
valid point. I don't know what I was thinking.
I feel pretty stupid when I see how short all the other solutions are T.T
It seems like some random cases have multiple solutions, in which case it expects what seems like the last sum you found if you work from left to right (might have been a coincidence, but that's what passed the random tests in my case). Any of the sums should be correct though.
Loading more items...