Cody

# Problem 40. Reverse Run-Length Encoder

Solution 328473

Submitted on 3 Oct 2013 by Chris E.
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 = [2 5 1 2 4 1 1 3]; correct = [5 5 2 1 1 1 1 3]; assert(isequal(correct, RevCountSeq(x)));

nc = 5 tc = 2 numlist = 5 numlist = 5 5 nc = 2 tc = 1 numlist = 2 5 5 nc = 1 tc = 4 numlist = 1 2 5 5 numlist = 1 1 2 5 5 numlist = 1 1 1 2 5 5 numlist = 1 1 1 1 2 5 5 nc = 3 tc = 1 numlist = 3 1 1 1 1 2 5 5 y = 5 5 2 1 1 1 1 3

2   Pass
%% x = [1 9]; correct = [9]; assert(isequal(correct, RevCountSeq(x)));

nc = 9 tc = 1 numlist = 9 y = 9

3   Pass
%% x = [9 1]; correct = ones(1,9); assert(isequal(correct, RevCountSeq(x)));

nc = 1 tc = 9 numlist = 1 numlist = 1 1 numlist = 1 1 1 numlist = 1 1 1 1 numlist = 1 1 1 1 1 numlist = 1 1 1 1 1 1 numlist = 1 1 1 1 1 1 1 numlist = 1 1 1 1 1 1 1 1 numlist = 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1

4   Pass
%% x = [1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9]; correct = 1:9; assert(isequal(correct, RevCountSeq(x)));

nc = 1 tc = 1 numlist = 1 nc = 2 tc = 1 numlist = 2 1 nc = 3 tc = 1 numlist = 3 2 1 nc = 4 tc = 1 numlist = 4 3 2 1 nc = 5 tc = 1 numlist = 5 4 3 2 1 nc = 6 tc = 1 numlist = 6 5 4 3 2 1 nc = 7 tc = 1 numlist = 7 6 5 4 3 2 1 nc = 8 tc = 1 numlist = 8 7 6 5 4 3 2 1 nc = 9 tc = 1 numlist = 9 8 7 6 5 4 3 2 1 y = 1 2 3 4 5 6 7 8 9

### Community Treasure Hunt

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

Start Hunting!
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://se.mathworks.com/matlabcentral/cody/problems/40-reverse-run-length-encoder/solutions/328473", "fetch_time": 1604141109000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2020-45/segments/1603107917390.91/warc/CC-MAIN-20201031092246-20201031122246-00010.warc.gz", "warc_record_offset": 493067027, "warc_record_length": 17181, "token_count": 784, "char_count": 1582, "score": 3.546875, "int_score": 4, "crawl": "CC-MAIN-2020-45", "snapshot_type": "latest", "language": "en", "language_score": 0.6917917132377625, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00030-of-00064.parquet"}