Cody

# Problem 19. Swap the first and last columns

Solution 1263193

Submitted on 5 Sep 2017 by Oliver Penn
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 = [ 12 4 7 5 1 4]; B_correct = [ 7 4 12 4 1 5 ]; assert(isequal(swap_ends(A),B_correct))

X = 12 4 7 5 1 4 X = 7 4 7 4 1 4 X = 7 4 12 4 1 5

2   Pass
A = [ 12 7 5 4]; B_correct = [ 7 12 4 5 ]; assert(isequal(swap_ends(A),B_correct))

X = 12 7 5 4 X = 7 7 4 4 X = 7 12 4 5

3   Pass
A = [ 1 5 0 2 3 ]; B_correct = [ 3 5 0 2 1 ]; assert(isequal(swap_ends(A),B_correct))

X = 1 5 0 2 3 X = 3 5 0 2 3 X = 3 5 0 2 1

4   Pass
A = 1; B_correct = 1; assert(isequal(swap_ends(A),B_correct))

X = 1 X = 1 X = 1

### Community Treasure Hunt

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

Start Hunting!
{"ft_lang_label":"__label__en","ft_lang_prob":0.58422554,"math_prob":0.9983952,"size":915,"snap":"2020-45-2020-50","text_gpt3_token_len":377,"char_repetition_ratio":0.14599341,"word_repetition_ratio":0.18181819,"special_character_ratio":0.4601093,"punctuation_ratio":0.066985644,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98649156,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-28T08:53:14Z\",\"WARC-Record-ID\":\"<urn:uuid:0e6afade-e6a4-43cd-ae95-48a26c84e3b0>\",\"Content-Length\":\"81393\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:27864b6e-f0b3-42a1-b3e2-18c952c6a7e7>\",\"WARC-Concurrent-To\":\"<urn:uuid:55320b21-445d-4b49-bcfd-1b02c7dbe107>\",\"WARC-IP-Address\":\"23.223.252.57\",\"WARC-Target-URI\":\"https://au.mathworks.com/matlabcentral/cody/problems/19-swap-the-first-and-last-columns/solutions/1263193\",\"WARC-Payload-Digest\":\"sha1:KH7TGOA5WEDTKGXD64JC5AENTJVLNWIS\",\"WARC-Block-Digest\":\"sha1:H3KURPPGX6PD57VQXNOL5CT245H6CFBB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141195198.31_warc_CC-MAIN-20201128070431-20201128100431-00163.warc.gz\"}"}