Ad
  • Default User Avatar

    Thanks, we actually handled this awhile back before translations were fully available. I will unpublish this.

  • Default User Avatar

    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.

  • Default User Avatar

    Thanks for the revision. Changed to MUST and clarified anything less than 1 should return an empty string without a newline ending.

  • Default User Avatar

    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.

  • Default User Avatar

    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 all Num and not just say Int.

    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.

  • Default User Avatar

    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.

  • Default User Avatar

    Awesome! Created the translation, not sure how that process works but hope I did it correctly. Thanks!

  • Default User Avatar

    .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.

  • Default User Avatar

    Maybe in some other form but I couldn't find one.

  • Default User Avatar

    You need to return the total now print to the screen.

  • Default User Avatar

    Very likely it's the line ending that you have. I will add this note to all tests.

  • Default User Avatar

    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.

  • Default User Avatar

    Thanks. Got it.

  • Default User Avatar

    Thanks, I forgot to update this kata with that.

  • Default User Avatar

    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...