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.
Nevermind. I was testing for the best case, which is a 10-element array. But with an average case of a 5-element array, they are even more similar, producing 4.0-4.1 unique elements each. So I still don't understand what do you mean.
I think you are mistaken about the chances of duplicate elements being lower on my translation. I tested both the JavaScript implementation with ~~(10*Math.random())+1 and my Ruby implementation using rand(1..10), and if I generate 100 arrays with 10 elements, both come back with between 6.3-6.6 unique elements on average. In fact, most of the times Ruby's kernel rand yields slightly more duplicates. So I'm not really sure what looks off to you about my translation.
Not saying they aren't too low, just saying they don't seem to be too low to me. :)
You could be right though, that's why I asked you to elaborate.
After testing it, I thought the chances looked pretty similar to the JavaScript implementation's.
Doesn't seem too low to me. Can you elaborate?
Thanks. Fixed!
Translated into Ruby :)
Rookie mistake. Added some :)
Seems a bit hard for me. I tried solving it with memoization, but my code times out on random tests. Though maybe I just suck. ;(
For anyone reading this monstrosity: I'm not proud of my solution, I just threw in random numbers until it worked.
I might be missing something, but I don't think this is 7 kyu anymore...
Thank you for looking into it! I hope they fix it soon. :)
When I attempt to solve it in Python, no matter what my code is I get:
"SyntaxError: Non-ASCII character '\xc2' in file main.py on line 14, but no encoding declared;"
What am I doing wrong?
Thanks for mentioning this. I got stuck on the same problem and couldn't figure out what was wrong with my code.