You had already added the original signature array to result, but you did it again in hte corresponding loop when n < 3.
signature
result
n < 3
Also, Your code fails for cases like signature = [2, 0, 1] and n = 2. The expected result should be [2, 0] but your code returns [2, 0, 1]
signature = [2, 0, 1]
n = 2
[2, 0]
[2, 0, 1]
Read this instruction carefully --> returns the first n elements - signature included of the so seeded sequence.
returns the first n elements - signature included of the so seeded sequence.
This comment is hidden because it contains spoiler information about the solution
Loading collection data...
You had already added the original
signature
array toresult
, but you did it again in hte corresponding loop whenn < 3
.Also, Your code fails for cases like
signature = [2, 0, 1]
andn = 2
. The expected result should be[2, 0]
but your code returns[2, 0, 1]
Read this instruction carefully -->
returns the first n elements - signature included of the so seeded sequence.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution