Beta

RegEx Like a Boss #5 CodeGolf: Decimal Number Divisible By 3

Description
Loading description...
Mathematics
Regular Expressions
Strings
Fundamentals
Restricted
Algorithms
View
AllIssues4Questions2Suggestions1Show Resolved
  • Please sign in or sign up to leave a comment.
  • Unnamed Avatar

    Since newlines are valid characters, there should be edge case tests with numbers divisible by 3 followed by one trailing newline.

  • pl3onasm Avatar

    I get Codegolf error: Your RegEx is 119 characters long. What is this supposed to mean? It is stated that the string length is restricted to 150. My string length is well below that.

    • Unnamed Avatar

      It's an incorrect test structure (@test.it without assertions), so it doesn't fail, but isn't shown as passed.

  • user9644768 Avatar
    • How negative binary numbers are represented(there are different method, btw python's bin represents -3 as -0b11)?
    • I am getting something like : Youre RegEx should NOT match ''11'', what's the point?
    • I've no idea why my code is not working here for number like 96(it is working fine on my laptop), what should I do?
    • Blind4Basics Avatar
      • you noticed you're working with decimal strings? not binary ones? So the negative numbers just have a "-" in the beginning, that's all
      • the point is that you know what is the input. and 11 (decimal!) isn't divisible by 3, yes, while your regex matched it. ;)
    • user9644768 Avatar

      Oh, there were 3-4 katas designed for binary numbers, so I thought.... Thanks.

      Question marked resolved by user9644768 5 years ago
  • Bubbler Avatar

    I wonder why those solutions on the Internet are soooo long. The shortest one I could find was 164 chars (without negative/leading zeros handling), while it can be done in 118 (with negative/leading zeros handling). I guess limiting the length to 150 or so will thwart most cheat/googling attempts.

    • sgerodes Avatar

      I think it would such a pain un the ass... There are so many Solutions taht are longer that 150 and wariors will just be disappointed that they cant pass even if they have good solutions.

    • sgerodes Avatar

      You know what. I changed my decision. Its a great idea that knocks out a lot of the googling part and forces to think. Implemented!

      Suggestion marked resolved by sgerodes 6 years ago
  • Blind4Basics Avatar

    This comment has been hidden.

  • Voile Avatar

    Random test range is kind of too tiny (5 digits is still somewhat easy to cheese). A range like -10^10 - 10^10 will ensure no shenanigans are possible.

    Of course, this also means you should state the input range in the description.

  • Voile Avatar

    Test case - should be in fixed tests.