Ad
  • Custom User Avatar
  • Custom User Avatar

    @Wei-LiangChew I'm a little late but then the while loop will iterate over with n - 1 = 8 (and so on)

  • Custom User Avatar

    But what if the largest 5-digit number in digits doesn't start with 9?

  • Custom User Avatar

    without using super, it can't be a best practice

  • Custom User Avatar

    This catches every missing method. Very bad practice.

  • Custom User Avatar

    Regex usually isn't the best for readability but it's a lot cleaner than how I removed the _ and =. I'm new to ruby so bare with me when I ask, are ternary operators prefered? I see them everywhere in the solutions but I've never liked the way read vs a regular if else.

  • Custom User Avatar

    This is short, which is fun. But the regex is nauseating.

  • Custom User Avatar

    I agree with this. This is also related to other suggestions about performance.

    Some solutions float to the top as "best practice" or "clever" even though they have clear issues. Negative flags could address this.

  • Custom User Avatar

    Great Job, I just started to learn regex, and I find it really useful ( rather than iterate over each caracter and check), it could be a little faster if you replace .sort.pop for .max, I'm still not sure how regex does it, because in order to find all chunks starting with 9 and 4 more digits it still needs to iterate over all the array, so Im not sure why my solution is slower, maybe because the regex is executed in a binary library rather than interpreted like ruby ?

  • Custom User Avatar

    The same came into my mind when implemented it.

  • Custom User Avatar
    console.log("<canvas id='myCanvas' width='200' height='100'style='border:1px solid #000000;'></canvas>")
    

    Putting this in the tests on a published kata and running them outputs a canvas with a red rectangle on it. I doubt a live kata based on this would be permitted, because the script tag is scary, which is why I suggested locking that down and offering supported methods.

    EDIT: This originally had script tags but, unsurprisingly, Codewars ate them. I followed the canvas tag with valid script tags in the same line.

  • Custom User Avatar

    I can't figure out how to do that, Josh. Doesn't look like you can console.log a script tag, to actually write to the canvas?

  • Custom User Avatar

    Oh ffs please put some commments on the test case results. I've got a test case failing with a trailing space with no explanation, where a previous test case with a trailing space passed. If you can't explain why my code is failing your tests I can't be arsed completing your kata.

  • Custom User Avatar

    I have seen some kata that may be considered trivia. I have even implemented a kata that could be considered trivia. I would like to see a ranking criteria for kata where the requirements may seem trivial but promote a generalizable concept.

  • Custom User Avatar

    'Best Practices' and 'Clever' are nice ways to flag a solution but there should be a 'Bad Practice' flag too.
    So many bad solutions (unreadble but short) get 'Best practice' flags and it's very missleading to anyone trying to learn from other peoples code. Negative flags would help counter this problem but might need a trial just incase we're all secretly trolls.

  • Loading more items...