Many thanks for taking the time to translate the Kata, looks good to me :D One thing though - would you mind adding the corresponding Ruby code blocks in the Kata description itself?
Haha. Brute force, I like it.
Hm, I solved this problem with Ruby, which isn't exactly known for high performance number crunching, and I did not have to do any performance optimization in order to get it to pass. In fact, I probably wasted a lot of cycles (and memory) by storing the chromosomes as strings instead bitfields.
lengthSol calls length.
randomInt doesn't look correct.
Approved. Thanks @PandaWhisperer :-)
def plural?(n), do: n != 1
You'd need a different set of currency for the greedy algorithm to fail. Try the sequal kata for something a little more challenging: https://www.codewars.com/kata/making-change-part-2
It's been in beta for years. :(
This comment is hidden because it contains spoiler information about the solution
Okay, I figured it out. The timeouts are intermittent (probably due to high server load). Sometimes it runs, sometimes it times out.
Regarding the second error, it looks like I was passing an Integer as the first argument to Float.round/2
I have a solution in Elixir that computes the sum of 1 million in about a second, but I'm getting a timeout error. Do I need a more efficient approach?
Additionally, I cannot round the result. I'm getting the following error when calling Float.round/2:
(FunctionClauseError) no function clause matching in Float.round/2
Is Float.round/2 not available in Elixir 1.2.4?
Nope. They're included.
you don't include 49 and 9
Yup. Works as expected now. Thanks.