Simplify Selection Ranges validator 1

Can’t find what is wrong for the validator 1 after I have submitted. Can somebody help I passed the other validator

Hi. I have the same problem. Tried it in Perl and in Bash. Both pass all 4 tests but fail Validator1 after submission.

At first I had the same problem as you guys, but then I noticed an error in my solution. It seems that Test 1 and Validator Test 1 are quite different :slight_smile: For me, there was a corner case which was not tested in tests 1-4, but it clearly made my solution not work. Good luck :slight_smile:

Thanks for your advice. But i can’t see the problem. I tested it with empty arrays, an array with all digits from 0-100, unsorted. Can you give us a more precice hint what corner case you missed?

You can usually attack these kinds of problems by generating a number of small, random inputs and checking manually what the outputs should be. So maybe check not a full, dense array or empty array, but something in the middle.

Also, my bug did not compute wrong values, but formatted the output incorrectly.

I don’t know, mb some negative numbers are the reason? Or zero…

I can tell you that all inputs are positive integers.

** HINT: You might want to consider what your code does if there are no contiguous numbers in the input? Try a few self-made examples like this.

  • danBhentschel

The hint with the random generated list was good. I found the bug after a view tries and finally i fixed it. Thx.

Ok I found my problem it really was an edge case when I had less than 3 non contiguous values at the limits of the specs. Thanks all

I have done lots of tests and still I am unable to find any errors to my solution. Can you provide some of your inputs that caused your program to run incorectly ?

Yeah, [1,2,99,100]


AMAZING !!! thx allot :smiley:

Hi! My solution also fails on validator 1, but the cases mentioned above are handled well. I really dont know where to find the issue. :frowning: