Ad
  • Custom User Avatar

    Hi,

    Yes, it's helpful, solution is fine now.

    I misunderstood the issue condition: i thought, that original sequence in formats {i, i+1, ..., i+n} or { i, i, ..., i}, but it's not...

  • Custom User Avatar

    Hi,

    Sorry, but you are wrong in your 2.2+ points. "Choose exactly one element from the sequence and replace it with another integer > 0. You are not allowed to replace a number with itself, or to change no number at all.". exactly one element - nothing about the first element, !=1 element, etc. ([42, 42, 42] => [1, 42, 42])

    Be careful, you should sort your output: [42, 32, 22] => [1, 22, 32]

    I hope this will be helpful

  • Custom User Avatar

    I was stuck at this edge case too, the error is due to the replacement condition not being fully satisfied:

    "You are not allowed to replace a number with itself, or to change no number at all"

    An array input of type [1,1] cannot be left as is and so the last digit gets replaced with the next smallest, which is "2" => [1,2].

  • Custom User Avatar

    Hello.
    I have a problem in Java, my solution test result: basicTests & edgeTests - ok, but randomTests: arrays first differed at element [0]; expected:<1> but was:<10>.

    There are these situations (i think so):

    1. Array contains 1 int:

    1.1. int = 1, output = 2 (example: 1 -> 2)

    1.2. int !=1, output = 1 (example: 42 -> 1)

    1. Array contains 2 or more int and all int equals:

    2.1. all int = 1, output = 1...1, 2 (example: 1,1,1 -> 1,1,2)

    2.2. all int > 1, output = int-1, int...int (example: 42,42,42 -> 41,42,42)

    1. Array contains 2 or more int and all int not equals (sequence: int, int+1, int+2, ..., int+n)

    3.1. first int = 1, int+n -> 1 (example: 1,2,3,4,5 -> 1,1,2,3,4)

    3.2. first int > 1, int+n -> int-1 (example: 3,4,5,6,7 -> 2,3,4,5,6)

    What's problem with it? Why random tests generates error? :(