Ad
  • Default User Avatar

    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.

  • Custom User Avatar

    It's not fast enough :( I'll need to refactor it if I'm going to pass again.

  • Custom User Avatar

    I tried, it passed as is in 9.x seconds