Cody

# Problem 40. Reverse Run-Length Encoder

Solution 1920822

Submitted on 3 Sep 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
x = [2 5 1 2 4 1 1 3]; correct = [5 5 2 1 1 1 1 3]; assert(isequal(correct, RevCountSeq(x)));

Error using regexprep The 'STRING' input must be either a char row vector, a cell array of char row vectors, or a string array. Error in RevCountSeq (line 2) y = regexprep(x,'(\d), (\d)','\${\$1}'); Error in Test1 (line 3) assert(isequal(correct, RevCountSeq(x)));

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

Error using regexprep The 'STRING' input must be either a char row vector, a cell array of char row vectors, or a string array. Error in RevCountSeq (line 2) y = regexprep(x,'(\d), (\d)','\${\$1}'); Error in Test2 (line 3) assert(isequal(correct, RevCountSeq(x)));

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

Error using regexprep The 'STRING' input must be either a char row vector, a cell array of char row vectors, or a string array. Error in RevCountSeq (line 2) y = regexprep(x,'(\d), (\d)','\${\$1}'); Error in Test3 (line 3) assert(isequal(correct, RevCountSeq(x)));

4   Fail
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)));

Error using regexprep The 'STRING' input must be either a char row vector, a cell array of char row vectors, or a string array. Error in RevCountSeq (line 2) y = regexprep(x,'(\d), (\d)','\${\$1}'); Error in Test4 (line 3) assert(isequal(correct, RevCountSeq(x)));
{"ft_lang_label":"__label__en","ft_lang_prob":0.5341568,"math_prob":0.9929596,"size":573,"snap":"2020-10-2020-16","text_gpt3_token_len":223,"char_repetition_ratio":0.15641476,"word_repetition_ratio":0.0,"special_character_ratio":0.43804538,"punctuation_ratio":0.13740458,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9943942,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-02-24T08:26:33Z\",\"WARC-Record-ID\":\"<urn:uuid:becc31ee-7da0-4915-b928-3ec2d197756e>\",\"Content-Length\":\"74895\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c43a9f5e-1b42-4b0d-b1ee-d3da47c256ba>\",\"WARC-Concurrent-To\":\"<urn:uuid:26b183c9-7508-475c-ad83-65c00fee710d>\",\"WARC-IP-Address\":\"23.0.20.241\",\"WARC-Target-URI\":\"https://au.mathworks.com/matlabcentral/cody/problems/40-reverse-run-length-encoder/solutions/1920822\",\"WARC-Payload-Digest\":\"sha1:NY5DQTFFQMGJWF7G3DKJGWX7NMOQN7HK\",\"WARC-Block-Digest\":\"sha1:7YJWJZFEPMKM62U2LGASBRLZWJDBJRFT\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-10/CC-MAIN-2020-10_segments_1581875145910.53_warc_CC-MAIN-20200224071540-20200224101540-00209.warc.gz\"}"}