Cody

# Problem 2651. Find the same and successive values in a vector

Solution 522957

Submitted on 6 Nov 2014 by Sid
• Size: 26
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = [1,0,0,1,1,1,1,0,1,1,1,0,0,0,1]; y = [ 2 4 9 12 3 7 11 14 0 1 1 0] assert(isequal(successive_value(x),y))

y = 2 4 9 12 3 7 11 14 0 1 1 0 ans = 2 4 9 12 3 7 11 14 0 1 1 0

2   Pass
%% x = [1,0,0,1,1,1,1,0,2,2,2,0,0,0,2345,2345,2345,2345,2345] y = [2 4 9 12 15 3 7 11 14 19 0 1 2 0 2345 ] assert(isequal(successive_value(x),y))

x = Columns 1 through 8 1 0 0 1 1 1 1 0 Columns 9 through 16 2 2 2 0 0 0 2345 2345 Columns 17 through 19 2345 2345 2345 y = 2 4 9 12 15 3 7 11 14 19 0 1 2 0 2345 ans = 2 4 9 12 15 3 7 11 14 19 0 1 2 0 2345

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!