Cody

# Problem 594. "Look and say" sequence

Solution 2062088

Submitted on 18 Dec 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
assert(isequal(look_and_say([1]),[1 1]))

Array indices must be positive integers or logical values. Error in look_and_say (line 6) if SEED(i) == SEED(i-1) Error in Test1 (line 1) assert(isequal(look_and_say([1]),[1 1]))

2   Fail
assert(isequal(look_and_say([1 1 1 1 1]),[5 1]))

NEXT = 0 6 1 NEXT = 6 1

Assertion failed.

3   Fail
assert(isequal(look_and_say([1 3 3 1 5 2 2]),[1 1 2 3 1 1 1 5 2 2]))

NEXT = 0 1 1 NEXT = 0 1 1 2 3 NEXT = 0 1 1 2 3 1 1 NEXT = 0 1 1 2 3 1 1 1 5 NEXT = 0 1 1 2 3 1 1 1 5 3 2 NEXT = 1 1 2 3 1 1 1 5 3 2

Assertion failed.

4   Pass
assert(isequal(look_and_say([8 6 7 5 3 0 9]),[1 8 1 6 1 7 1 5 1 3 1 0 1 9]))

NEXT = 0 1 8 NEXT = 0 1 8 1 6 NEXT = 0 1 8 1 6 1 7 NEXT = 0 1 8 1 6 1 7 1 5 NEXT = 0 1 8 1 6 1 7 1 5 1 3 NEXT = 0 1 8 1 6 1 7 1 5 1 3 1 0 NEXT = 0 1 8 1 6 1 7 1 5 1 3 1 0 1 9 NEXT = 1 8 1 6 1 7 1 5 1 3 1 0 1 9