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.
Short and sweet, but not best practices. I think this is a cute and clever solution for a simple string, but not efficient if the input was 100s or 1000s of characters long. I'd prefer a solution that returned false as soon as a lowercase character was found. In this case this solution is O(n) yet always the worst case, meaning that it always has to reach the last item (ALL characters must be uppercased) before it can determine the boolean value. This is more of a JS like solution than an Elixir solution. Elixir has better "tools" for working with strings.
This is very clever!!!
!
Done!
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
callslength
.randomInt
doesn't look correct.Approved. Thanks @PandaWhisperer :-)
Mejor:
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
:Is
Float.round/2
not available in Elixir 1.2.4?Nope. They're included.
Loading more items...