Ad
  • Custom User Avatar

    I would argue that in this particular scenario the Stack Class its perfect; From the documentation itself "A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class.", yet in this scenario all of the extra features available with Deque will not be used, a simple stack data structure is more than perfect for this scenario.

  • Default User Avatar
  • Custom User Avatar

    Duplicate issue below

  • Custom User Avatar

    A lot of the Dart solutions do not work with Unicode.

    If want to make this trickier, add a test for this ;)

    'unicode\u{10428}' // 'unicode𐐨' => 'uNiCoDe𐐀'
    

    List of lower case unicode chars:

    https://www.compart.com/en/unicode/category/Ll

  • Custom User Avatar

    Can't be changed.

  • Custom User Avatar

    Definitely 4 kyu.

    When I completed back in the day it was 3 kyu.

    I tried to change to 4 kyu seeing that you have 13 upvotes and someone saying that 3 kyu is too much has -2.

    Unfortunatelly only an admin can change this Kata right now

  • Custom User Avatar

    Crystal issue, not a kata issue.

    If you do the following in your code, a "BUG...downcast...Float64" with a bunch of "??" will appear:

    return "" if n < 0 || n > 99999 || !n.is_a?(Int)
    
    puts "#{n.to_i}" # Triggers bug
    

    Instead, you have to break it up like this:

    return "" unless n.is_a?(Int)
    return "" if n < 0 || n > 99999
    
    puts "#{n.to_i}" # ok
    

    This is only a bug in this version of Crystal. In v0.33, it works fine.

    Also, you'll need to cast any division: (n / 10).to_i

    In new versions of crystal, you can do this: (n // 10)

  • Custom User Avatar

    I think so,aha

  • Custom User Avatar

    Well, I got it using sys.stderr.write. My solution has one zero in it. I don't know why, so I'll look at fixing my solution.

  • Custom User Avatar

    My solution passes all tests but the last one of the multi-solution.
    It just says Incorrect solution: False should equal True.

    When I try to do a print or sys.stdout.write to see what the board is, nothing is logged for it, so I assume you are supressing the log for the last solution? But, I get a log for the other solutions.

    It's weird that my solution passes all multi-solutions except for the last one. Does the last one check all multi solutions? Or does it just check if valid?

  • Custom User Avatar

    Thank you! About #to_i - indeed, had C++ in my mind by the time :)

  • Custom User Avatar

    In the instructions:

    array = [[1,2,3],
             [8,9,4],
             [7,6,5]]
    snail(array) #=> [1,2,3,4,5,6,7,8,9]
    

    Shouldn't the result be this?

    snail(array) #=> [1,2,3,6,9,8,7,4,5]
    

    I think it's confusing.

  • Custom User Avatar

    Interesting solution. I had never used tr(...) or each_cons(...) before.

    I think ch.ord - '0'.ord is unnecessary. You can just do ch.to_i.

  • Custom User Avatar

    If STDOUT error, then you need to remove your System.out.println statements. You're probably printing too much.

  • Custom User Avatar

    For Ruby, no tests or method declaration.

  • Loading more items...