Ad
  • Default User Avatar

    Elegant. Well done.

  • Default User Avatar

    Test cases are inconsistent. The spec states to strip leading and trailing whitespace. And yet:

    solution("'\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?", ["'", "@", ".", "-", "^"])
    Expected: "\n# watermelons , , \noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"
    got: "\n# watermelons , ,\noranges watermelons watermelons watermelons bananas\npears bananas pears lemons # ?"

    The test case expects a string with trailing whitespace preserved, not stripped.

  • Default User Avatar

    My solution can be made to run slightly faster by eliminating the "puts n" statement, which was intended only for dev/debugging.

  • Default User Avatar

    500_000_000.times do
    next_bigger(12345678987654321_i64)
    end

    10 iterations of your code: 53.169s
    500_000_000 iterations of my code: 47.289s

  • Default User Avatar

    Some test cases are bad for this challenge in that they require outright violations the problem spec. Others have noted these test cases in past comments, so I won't list them here. The technical writing of the challenge details is of very poor quality. But hey, this site is free and you get what you pay for. Perhaps it's time to look around for a better coding challenge website.

  • Default User Avatar

    Much respect to whoever submits a more performant solution to this challenge.
    I'd love to see how you did it.

  • Default User Avatar

    This specification for this challenge has some issues.
    In particular, "this percent of loss increases of 0.5 percent at the end of every two months" is quite literally incorrect. It should read "this percent of loss increases of 0.5 percent at the beginning of every second month".
    I originally coded my solution according to the literal meaning of the problem description, but then had to use trial and error to figure out what the author really expected.
    Another issue is that "of" in the context of "increase(s) of 0.5 percent" normally indicates multiplication, not addition. I originally interpreted this as "increases at a rate of 0.5 percent",
    which complicated my trial and error analysis of the author's intended meaning.
    The really nice thing about this challenge, as written, is that it exposes students to the quality of technical writing that they should expect to encounter in the real world.

  • Default User Avatar

    Runtime crash on get_middle("").

  • Default User Avatar

    Brevity is nice. But no runtime error on get_middle("") is nicer.

  • Default User Avatar

    Munto, your method fails the following obvious test case:
    test(['n', 'n', 'n', 'n', 'e', 'e', 'n', 's', 'e', 'w'], false)

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution