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.
tbh, I was surprised myself, especially since the Sample Tests by themselves ran quite a bit faster than they do in the Julia version (this detail made me believe the slowness is mostly language related rather than something like the codewars R runner slowing things down).
I'm still relatively new to R, but from what I understand, it is just innately slow along with the added caveat
R + for loop = heat death of the universe
. Unfortunately, I couldn't find other meaningful areas to use its innate vectorization (which tends to speed things up). Any other idiomatic optimizations I tried gave marginal or no gains while further limiting the readability of the reference solution.In the end, after quite a bit of tinkering, this is about as fast as I could get it to go. That being said, I can't be certain I haven't missed some other implementation detail particular to R.
It's not fast enough :( I'll need to refactor it if I'm going to pass again.
I tried, it passed as is in 9.x seconds