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.
Is there a reason this isn't being tested within some tolerance? I've solved this on Python without issue, except that for ~1-5 random test cases I'm off by 1/1000 which makes the rounding break the other direction(e.g. 0.444 => 0.44 vs 0.445 => 0.45).
I'm new to golang and I don't understand how this solution works. Doesn't i track with the index of arr? So i, v := range arr[1:] would yield {1, arr[1]}, {2, arr[2]}, etc. What am I misunderstanding?
I loved this kata! At first I thought it was trivial, but when you stated it could be solved without loops I got interested. It took me the better part of 30m to work it out (my math is rusty), but it was a lot of fun. Thanks for sharing it!
The return type for the function is incorrect in golang. It should be int64 rather than float64. Thankfully changing this allows the code to pass the tests, but it's incorrect by default.