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.
Thanks, we actually handled this awhile back before translations were fully available. I will unpublish this.
You are correct. If you have it as a list then doing
in
will cause O(n) operation resulting in an O(n^2) complexity; however, this is targeted at beginners and expecting optimal solutions wasn't a goal.Thanks for the revision. Changed to MUST and clarified anything less than 1 should return an empty string without a newline ending.
Because by definition of the problem "You cannot use the uniq method on Arrays (don't even try it)."
It's disabled because it defeats the purpose of the Kata to use a built-in method that solves the problem.
I agree, we can leave out the
Double
test. I think it's nice to have but due to the case of floating point error, it takes away from the actual challenge if one has to worry of such but it is key to make sure that the solution works for allNum
and not just sayInt
.I did not author the Haskell part of this challenge but if @jhoffner has an opinion that'd be helpful. I cannot seem to modify the test cases for Haskell, not sure if bug or feature.
Sorry, I seemed to have missed an email detailing this comment.
Your solution is close but realize that Array.map will return an array with the block executed on each element of the array!
So you should be making sure to return the
sum
would be a good idea.Awesome! Created the translation, not sure how that process works but hope I did it correctly. Thanks!
.each
will only allow 1 parameter for the block so you cannot do:numbers.each {|total, i| total += i}
You can do
numbers.each { |i| total += i }
but you'll need total be done in some other way.Maybe in some other form but I couldn't find one.
You need to return the total now print to the screen.
Very likely it's the line ending that you have. I will add this note to all tests.
Thanks for the suggestion. Although I do like the added difficulty of removing it from the end or making sure not to add or using
chomp
, I believe in a console application you'd want the\n
therefore I am leaving it.Thanks. Got it.
Thanks, I forgot to update this kata with that.
What special cases are you thinking about?
I'll think about error checking but I don't want to bog the problem down for beginners with error checking.
Loading more items...