7 kyu

Always perfect

655 of 1,241bereket2015
Description
Loading description...
Strings
Arrays
Mathematics
Regular Expressions
Fundamentals
  • Please sign in or sign up to leave a comment.
  • nachorojo2015 Avatar

    this kata needs a checkup

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • zdreagin Avatar

    I saw another user had previously reported this issue, and though it was marked resolved, it has not been resolved. For input "0,1,2,3", the expected return value is "incorrect input" even though the input fits the criteria specified in the description (four consecutive numbers separated by commas). If this is considered incorrect input because it includes a zero (which is my best guess), then the description should be updated to use either "positive integers" or "natural numbers" in place of the word "numbers". If this is not the case, then the test case itself should be corrected.

    Regardless of the reason the test case fails, the word "numbers" is too inclusive a term to be used in the description. If zero is considered valid input, then the term "whole numbers" should be used instead.

    Edit: This is for the JavaScript version. I'm not sure if other versions have this issue as well.

  • ejini战神 Avatar

    Description does not mention whether negative numbers will be tested

    Also inconsistency regarding this part in all languages (No tests in JS, but some in Python, Ruby)

  • vvedenskiy Avatar

    Validations in this kata are absolutely disgusting.

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • Emzed89 Avatar

    Somehow got the following complaint from the random tests (Ruby): "0-8,-7,-6,-5" It should work for random inputs too - Expected: "not consecutive", instead got: "incorrect input"

  • Haksell Avatar

    This comment has been hidden.

  • user7527943 Avatar

    In the JS version... Why, with an input of "0,1,2,3", does the kata expected a result of "incorrect input" when that input seemingly meets the kata's criteria? It's exactly four consecutive numbers, separated by commas, whose product plus one is a perfect square (which happens to be 1).

  • FArekkusu Avatar

    Python 3 should be enabled.

  • FArekkusu Avatar

    The random tests in Python generate values like 0-7.

    Also, when this happens the reference cannot convert such value to int, and the error message gives away the solution.

  • cliffstamp Avatar

    Ruby :

    • the random generator can sometimes produce numbers like "079" as a string which will catch some solutions which could be incorrect depending on how you read the description, but it is rare happening at most once in a few trials

    • the test suite doesn't produce possible edge cases just look at how I tested for non-consecutive numbers which worked but should not (1,1,1,3) will pass my solution but should not

  • nwebz Avatar

    awesome kata, personally i would have ranked it at 6 kyu but perhaps my standards are too low.

  • BK2016 Avatar

    Help please !!! My code is failing the last 2 test in Ruby, I can't figure out where the problem is:

    Expected: "25, 5", instead got: "incorrect input" Expected: "1, 1", instead got: "incorrect input" 18 Passed 2 Failed 0 Errors

  • donaldsebleung Avatar

    JS Version of Kata needs random test cases

  • Nestorfish Avatar

    Random broken tests:

    Testing for "-6,-5,1-4,-3"
    It should work for random inputs too - Expected: "not consecutive", instead got: "incorrect input"
    Testing for "0-1,0,1,2"
    It should work for random inputs too -  Expected: "not consecutive", instead got: "incorrect input"
    Testing for "-9,1-8,-7,-6"
    It should work for random inputs too -  Expected: "not consecutive", instead got: "incorrect input"
    

    These are invalid inputs.

  • jacobb Avatar

    Basically what anter69 said, but also with an additional test case for sequential numbers that don't all have the same number of digits (to break string sort solutions).

  • anter69 Avatar

    Doing 8 kyu katas so far, this seems a bit too difficult for 7 kyu. At least the checking of negatives/non-numbers is not simple without the knowledge of try - except (in python).

    On the other hand, you could/should check unsorted, but otherwise correct sequences (e.g. 1,4,2,3) which would be valid, as those are 4 consecutive numbers (even if they are not ordered).

    Cheers

  • danfrenette Avatar

    Two of the tests input strings ending with commas (ex. ",1,2,3,4,"). Not sure if that was intentional or not, but since it wasn't shown in any of the examples I'd suggest fixing that. Other than that I thought this was a really fun kata :)

  • Adrian1707 Avatar

    Very frustrating to have Expected: 841, 29, instead got: 841, 29,

    Any clue why this is happening? I've ran tests on my code and it seems to work fine.

  • kmj442 Avatar

    The 4 real test I get this: 10,11,12,13,15 'not consecutive' should equal 'incorrect input'

    To me that should be not consecutive.

  • sempjc Avatar

    I edit my solution and find a way to make the first test of the "submit test" pass. But notice in the second test this:

    #From the Submit test

    Test Passed: Value == incorrect input
    Expected: 17161, 131, instead got: 17,161, 131'
    1 Passed
    1 Failed
    0 Errors
    

    The different I notice is a miss comma (,) in the test answer.

    But in the regular "test" you need a comma to make this answer correct #Line from the regular test

    Test.assertEquals(checkRoot('30,31,32,33'),   '982,081, 99'
    

    BTW I really enjoy this Kata :) And I learned a bunch of thing while solving this :)

  • bdarksider Avatar

    'not consecutive' should equal '25, 5' 18 Passed 1 Failed 0 Errors

    I think there is some error with test. In my python shell for string '1,2,3,4' the output is showing '25, 5' which I think is the only possible case for getting '25, 5'. Or... is there the possiblity of negative numbers? like '-1,-2,-3,-4'. I have tried all possiblites like: '4,5,6,7' '4,5,d,7' '10,13,12,14' all are showing expected results.

  • sempjc Avatar

    This comment has been hidden.

  • GiacomoSorbi Avatar

    Upvoted, approved, translated (Ruby and Python, as usual) and I must say solving this as a one-liner was quite fun: thanks :)

    Oh, I forgot: you may wish to remove the tests in JS with too large numbers, as JS is rather prone to precision errors past the 15th digit.

  • kayahr Avatar

    The test cases are completely broken, they always pass, no matter what I return.