Ad
  • Default User Avatar
  • Custom User Avatar
    • missing edge case: 'A'.repeat(200)
    • the behavior for more than 2 rainbows isn't specified. If the case can never occur, it should be told in the description.
  • Custom User Avatar

    markdowns formatting are broken in the description

  • Custom User Avatar

    I don't understand if the function should return that there is at least one rainbow in the case where the elements are there but not in order.
    For example, is there 'RED' in 'DER'?

  • Custom User Avatar

    All the way across the sky!
    ...whoa

  • Custom User Avatar

    What does this mean? It's so bright, so vivid

  • Custom User Avatar

    I've just republished this kata with improvements: https://www.codewars.com/kata/double-rainbow
    Thanks for your help with the (very fundamental) issues last time!

  • Custom User Avatar

    I've just republished this kata with improvements: https://www.codewars.com/kata/double-rainbow
    Thanks for your help with the (very fundamental) issues last time!

  • Custom User Avatar

    I have just republished this kata (with improvements) here: https://www.codewars.com/kata/double-rainbow
    Hopefully should be much less basic problems this time around!

  • Custom User Avatar

    Thanks for the explanation!

    I haven't encountered constants yet, but will certainly look into them.

    I'm under no illusions that my solution will by any means be the most efficient/concise/elegant - am very much expecting others to submit far shorter, better solutions at this point!

    Apreciate the explanations.

  • Custom User Avatar

    You were reinventing a lot of wheels. One of them was that Object with sequential numerical keys. You could just have defined const LETTERS=" ABDEGILNORTUVWY" ( constants should have names in ALL_CAPS ), and it would have behaved exactly like letterObj ( apart from the element at index 0. but you could have made that work, somehow, probably ). LETTERS[1] would have been "A", etc etc.

    People do it all the time, and I catch myself doing it sometimes: defining an Array ["a","b","c"] instead of simply a String "abc". You only went a step further even, defining an Object that could have been simply a String, with all the appropriate properties.

    That's all it was really. It works, but it could have been done more simply.

  • Custom User Avatar

    Sorry to get back to you on this so late, but would you mind explaining what you mean by this comment below? (I can't seem to be able to reply directly to that comment, so I'm quoting it here):

    "Also, this

    var letterObj = {1:'A', 2:'B', 3:'D', 4:'E', 5:'G', 6:'I', 7:'L', 8:'N', 9:'O', 10:'R', 11:'T', 12:'U', 13:'V', 14:'W', 15:'Y'};

    is what strings (and arrays) are for, and please indent your solution properly. It's unreadable."

    I understand what strings and arrays are, of course, but not what you mean by your suggestion. I also understand that the indentation is not ideal, and am fixing that.

    Thank you.

  • Custom User Avatar

    Thanks, I may do that!

  • Custom User Avatar

    You're always welcome to fix this kata and then make a brand new kata with it ;-)

  • Custom User Avatar

    The point of random tests is not that the input is random, it is that the expected output is random. The usual way to achieve this is generating random input, processing it through a reference solution and comparing that output to the user output for the same input. Alternatively, you generate a random output, generate a matching input, and compare the output to the user output for that input. ( Sometimes, there are still other ways to randomly test. )

    5 true 5 false is too predictable; I don't have to look at the input at all, just count inputs.

    Test.randomize does not fully automate random testing, but it will shuffle an array ( and, by extension, a string ); you don't have to write code to do this yourself.

    It's too late for this kata I suppose, it being retired ( I don't really know what that means, but it isn't showing up any more in places it used to ), but you get a second shot at a first kata.

  • Loading more items...