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.
The Kata definition is:
Build a function that returns an array of integers from n to 1 where n>0.
parentheses are not required here
How does this one work?
+1
Sure! So you're provided with different options and weights. Like a probability for each option. So basically what you need is to get a random value between 0 and total and to see into which sector it appeared.
Great series! Enjoyed a lot!
Task is cool, but story sucks.
It took me some time to understand the problem conditions. Definitely shall be 7kyu.
It's more math task than programming. A good one though.
This comment is hidden because it contains spoiler information about the solution
Forgot about OR (|) in regex. I would replace double-quotes with quotes to make it even better.
Empty array will result division by zero.