Cody

# Problem 875. Return a list sorted by number of consecutive occurrences

Solution 2023828

Submitted on 16 Nov 2019 at 3:03 by Doan Quang Manh
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   Pass
x = [1 2 2 2 3 3 7 7 93] y_correct1 = [2 3 7 1 93] ; assert(isequal(popularity_bis(x),y_correct1))

x = 1 2 2 2 3 3 7 7 93 x = 1.0000 2.0000 2.0000 2.0000 3.0000 3.0000 7.0000 7.0000 93.0000 1.1000 b = 1 1 a = 1 a = 2 a = 3 b = 1 1 3 2 a = 1 a = 2 b = 1 1 3 2 2 3 a = 1 a = 2 b = 1 1 3 2 2 3 2 7 a = 1 b = 1 1 3 2 2 3 2 7 1 93 a = 1 d = 1 3 2 2 1 c = 1 2 3 7 93 P = 1 2 3 4 5 b = 1 1 3 2 2 3 2 7 1 93 B = 3 2 2 1 1 I = 2 3 4 1 5 b = 3 2 2 3 2 7 1 1 1 93 y = 2 3 7 1 93

2   Pass
x = [1 1 2 2 2 3 3 7 7 1 93]; y_correct2 = [2 1 3 7 1 93] ; assert(isequal(popularity_bis(x),y_correct2))

x = 1.0000 1.0000 2.0000 2.0000 2.0000 3.0000 3.0000 7.0000 7.0000 1.0000 93.0000 1.1000 a = 2 b = 2 1 a = 1 a = 2 a = 3 b = 2 1 3 2 a = 1 a = 2 b = 2 1 3 2 2 3 a = 1 a = 2 b = 2 1 3 2 2 3 2 7 a = 1 b = 2 1 3 2 2 3 2 7 1 1 a = 1 b = 2 1 3 2 2 3 2 7 1 1 1 93 a = 1 d = 2 3 2 2 1 1 c = 1 1 2 3 7 93 P = 1 5 2 3 4 6 b = 2 1 1 2 3 3 2 7 2 1 1 93 B = 3 2 2 2 1 1 I = 3 1 4 5 2 6 b = 3 2 2 1 2 3 2 7 1 1 1 93 y = 2 1 3 7 1 93

3   Pass
x = [1 0 0 2 2 -5 9 9 2 1 1 1 0 11]; y_correct1 = [1 0 2 9 -5 0 1 2 11] ; assert(isequal(popularity_bis(x),y_correct1))

x = 1.0000 0 0 2.0000 2.0000 -5.0000 9.0000 9.0000 2.0000 1.0000 1.0000 1.0000 0 11.0000 1.1000 b = 1 1 a = 1 a = 2 b = 1 1 2 0 a = 1 a = 2 b = 1 1 2 0 2 2 a = 1 b = 1 1 2 0 2 2 1 -5 a = 1 a = 2 b = 1 1 2 0 2 2 1 -5 2 9 a = 1 b = 1 1 2 0 2 2 1 -5 2 9 1 2 a = 1 a = 2 a = 3 b = 1 1 2 0 2 2 1 -5 2 9 1 2 3 1 a = 1 b = 1 1 2 0 2 2 1 -5 2 9 1 2 3 1 1 0 a = 1 b = 1 1 2 0 2 2 1 -5 2 9 1 2 3 1 1 0 1 11 a = 1 d = 1 2 2 1 2 1 3 1 1 c = -5 0 0 1 1 2 2 9 11 P = 4 2 8 1 7 3 6 5 9 b = 1 1 2 0 1 2 1 -5 3 9 2 2 1 1 2 0 1 11 B = 3 2 2 2 1 1 1 1 1 I = 5 2 6 8 1 3 4 7 9 b = 3 1 2 0 2 2 2 9 1 -5 1 0 1 1 1 2 1 11 y = 1 0 2 9 -5 0 1 2 11

4   Pass
x = [1 0 1 1 0 0]; y_correct0 = [0 1 0 1] ; assert(isequal(popularity_bis(x),y_correct0))

x = 1.0000 0 1.0000 1.0000 0 0 1.1000 b = 1 1 a = 1 b = 1 1 1 0 a = 1 a = 2 b = 1 1 1 0 2 1 a = 1 a = 2 b = 1 1 1 0 2 1 2 0 a = 1 d = 1 1 2 2 c = 0 0 1 1 P = 2 4 1 3 b = 1 1 2 0 1 1 2 0 B = 2 2 1 1 I = 2 4 1 3 b = 2 0 2 1 1 0 1 1 y = 0 1 0 1

5   Pass
x = [0 1 0 0 1 1]; y_correct1 = [0 1 0 1] ; assert(isequal(popularity_bis(x),y_correct1))

x = 0 1.0000 0 0 1.0000 1.0000 1.1000 b = 1 0 a = 1 b = 1 0 1 1 a = 1 a = 2 b = 1 0 1 1 2 0 a = 1 a = 2 b = 1 0 1 1 2 0 2 1 a = 1 d = 1 1 2 2 c = 0 0 1 1 P = 1 3 2 4 b = 1 0 2 1 1 0 2 1 B = 2 2 1 1 I = 2 4 1 3 b = 2 0 2 1 1 0 1 1 y = 0 1 0 1