Cody

Problem 16. Return the largest number that is adjacent to a zero

Solution 1817599

Submitted on 16 May 2019 by Qinghua Ye
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
a = [1, 5, 3, 0, 2, 7, 0, 8, 9, 1 0]; b = 8; assert(isequal(nearZero(a),b))

2   Pass
a = [5 4 -1 0 -2 0 -5 8]; b = -1; assert(isequal(nearZero(a),b));

3   Pass
a = [0 3 1 0 2 9]; b = 3; assert(isequal(nearZero(a),b));

4   Pass
a = [1 0 2 0 3]; b = 3; assert(isequal(nearZero(a),b));

5   Pass
a = [0 -1]; b = -1; assert(isequal(nearZero(a),b));

6   Pass
a = [0 -12 0 -7 0]; b = -7; assert(isequal(nearZero(a),b));
{"ft_lang_label":"__label__en","ft_lang_prob":0.5881488,"math_prob":0.99948317,"size":790,"snap":"2019-43-2019-47","text_gpt3_token_len":332,"char_repetition_ratio":0.17430025,"word_repetition_ratio":0.027972028,"special_character_ratio":0.48227847,"punctuation_ratio":0.18811882,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9827026,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-10-23T09:26:05Z\",\"WARC-Record-ID\":\"<urn:uuid:6ad7887b-e6eb-4f0f-973b-524e35c735ab>\",\"Content-Length\":\"74627\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:8f002a55-a41f-481a-952f-6096d45c251e>\",\"WARC-Concurrent-To\":\"<urn:uuid:97aa7e34-4207-450d-9820-07917e24ade4>\",\"WARC-IP-Address\":\"184.25.188.167\",\"WARC-Target-URI\":\"https://www.mathworks.com/matlabcentral/cody/problems/16-return-the-largest-number-that-is-adjacent-to-a-zero/solutions/1817599\",\"WARC-Payload-Digest\":\"sha1:47HTO5JIV3TYVXN56ZLZAIV2C4NWCUDS\",\"WARC-Block-Digest\":\"sha1:GP4CVA2BQOX4ZOLMQE7Y635KWMDZOEFI\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-43/CC-MAIN-2019-43_segments_1570987829507.97_warc_CC-MAIN-20191023071040-20191023094540-00273.warc.gz\"}"}