{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":42715,"title":" Throw common elements of two vector arrays in sorted manner","description":"\r\nThrow common elements as output in sorted manner (acending order) of two given input vector arrays","description_html":"\u003cp\u003eThrow common elements as output in sorted manner (acending order) of two given input vector arrays\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nA = [1 2 3 4 5 6 7 8];\r\nB = [4 5 6 6 7 0 12 34];\r\ny_correct = [7 6 5 4];\r\nassert(isequal(your_fcn_name(A,B),y_correct))\r\n\r\n%%\r\nA = [1 2 3 4 5 6 71 8];\r\nB = [4 5 6 6 7 0 12 34];\r\ny_correct = [6 5 4];\r\nassert(isequal(your_fcn_name(A,B),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46868,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":74,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-01-15T10:10:48.000Z","updated_at":"2026-02-28T08:11:04.000Z","published_at":"2016-01-15T10:17:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThrow common elements as output in sorted manner (acending order) of two given input vector arrays\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":56568,"title":"Remove Duplicates","description":"Remove duplicates from the vector of integers and display in sorted order","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eRemove duplicates from the vector of integers and display in sorted order\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 3 4 1 2 4 2345 252  23];\r\ny_correct = [1 2 3 4 23 252 2345];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":2797263,"edited_by":2797263,"edited_at":"2022-11-09T21:46:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-11-09T21:44:10.000Z","updated_at":"2026-03-09T18:42:41.000Z","published_at":"2022-11-09T21:46:56.000Z","restored_at":"2022-11-10T15:14:33.000Z","restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemove duplicates from the vector of integers and display in sorted order\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":55005,"title":"Sort vector by number of prime factors of each element ","description":"Sort a given array based on how many prime factors each term has. Sort from least to greatest and output original values. \r\nEx:\r\nInput: [17, 23432432, 442, 12, 16, 71]\r\nOut: [17, 71, 442, 12, 16, 23432432]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 111px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 55.5px; transform-origin: 407px 55.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort a given array based on how many prime factors each term has. Sort from least to greatest and output original values. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 9.5px 8px; transform-origin: 9.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEx:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 119.5px 8px; transform-origin: 119.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInput: [17, 23432432, 442, 12, 16, 71]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 115.5px 8px; transform-origin: 115.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOut: [17, 71, 442, 12, 16, 23432432]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function sorted = Prime_Factor_Sort(x)\r\n  sorted = x\r\nend","test_suite":"%%\r\nx = [664   992   944   350   193   920   289   551   919    90];\r\ny_correct = [193   919   289   551   664   350    90   944   920   992];\r\nassert(isequal(Prime_Factor_Sort(x),y_correct))\r\n\r\n%%\r\nx = [17, 23432432, 442, 12, 16, 71];\r\ny_correct = [17, 71, 442, 12, 16, 23432432];\r\nassert(isequal(Prime_Factor_Sort(x),y_correct))\r\n\r\n\r\n%%\r\nx = primes(25);\r\nx = x(randperm(numel(x)));\r\nassert(isequal(Prime_Factor_Sort(x),x))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2453230,"edited_by":223089,"edited_at":"2022-08-20T10:55:57.000Z","deleted_by":null,"deleted_at":null,"solvers_count":24,"test_suite_updated_at":"2022-08-20T10:55:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-07-12T19:07:47.000Z","updated_at":"2026-03-05T10:29:22.000Z","published_at":"2022-07-12T19:07:47.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a given array based on how many prime factors each term has. Sort from least to greatest and output original values. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEx:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput: [17, 23432432, 442, 12, 16, 71]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOut: [17, 71, 442, 12, 16, 23432432]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":58593,"title":" findPositiveEvenNumbers ","description":"Write a MATLAB function findPositiveEvenNumbers that takes an array of integers as input and returns a new array containing only the positive even numbers from the input array. The output array should be sorted in ascending order.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 21px; transform-origin: 407.5px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a MATLAB function findPositiveEvenNumbers that takes an array of integers as input and returns a new array containing only the positive even numbers from the input array. The output array should be sorted in ascending order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(inputArray)\r\n    y = inputArray;\r\nend","test_suite":"%%\r\nx = [3, -2, 8, 0, -5, 12, -10, 7];\r\ny_correct = [8, 12];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":10,"comments_count":0,"created_by":3495653,"edited_by":3495653,"edited_at":"2023-07-18T13:35:17.000Z","deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-07-17T23:19:52.000Z","updated_at":"2026-02-27T14:12:15.000Z","published_at":"2023-07-17T23:19:52.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a MATLAB function findPositiveEvenNumbers that takes an array of integers as input and returns a new array containing only the positive even numbers from the input array. The output array should be sorted in ascending order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46108,"title":"Sort in descending order.","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 20.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 331.5px 10.4px; transform-origin: 331.5px 10.4px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 308.5px 10.4px; text-align: left; transform-origin: 308.5px 10.4px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven a vector x. Sort the vector in descending order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function x_sort = sort_descending(x)\r\nx_sort = - sort(-x);\r\nend","test_suite":"%%\r\nx = [-3 1 8 2];\r\ny_correct = [8 2 1 -3];\r\nassert(isequal(sort_descending(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":505754,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":111,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-08-05T20:45:01.000Z","updated_at":"2026-03-16T01:33:03.000Z","published_at":"2020-08-05T20:45:01.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector x. Sort the vector in descending order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46893,"title":"Sort accordingly","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 20.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.4px; transform-origin: 407px 10.4px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.4px; text-align: left; transform-origin: 384px 10.4px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven x, output is a magic(x) matrix that has a sorted columns accorind to its last column\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = ?\r\nend","test_suite":"%%\r\nx = 3;\r\ny_correct = [4     9     2\r\n     8     1     6\r\n     3     5     7];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = [ 4    14    15     1\r\n     5    11    10     8\r\n     9     7     6    12\r\n    16     2     3    13];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":54,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-17T20:34:27.000Z","updated_at":"2026-03-02T09:13:46.000Z","published_at":"2020-10-17T20:34:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven x, output is a magic(x) matrix that has a sorted columns accorind to its last column\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":61030,"title":"The MATLAB Treasure Hunt – Decode the First Clue Hidden in a Jumbled Sequence of Numbers","description":"You discover an ancient parchment inside the college archives. It contains a jumbled sequence of numbers that seems meaningless — until you notice faint MATLAB-like symbols next to it!\r\nYour first task is to decode the clue by arranging the numbers in ascending order. The smallest number might mark the beginning of the treasure trail.\r\nGiven a row vector a, return another vector b containing all elements of a sorted in increasing order.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 61.5px; transform-origin: 408px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou discover an ancient parchment inside the college archives. It contains a jumbled sequence of numbers that seems meaningless — until you notice faint MATLAB-like symbols next to it!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYour first task is to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003edecode the clue\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by arranging the numbers in \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eascending order\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The smallest number might mark the beginning of the treasure trail.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a row vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ea\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, return another vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eb\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e containing all elements of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ea\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e sorted in increasing order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = firstClue(a)\r\n  y = x;\r\nend","test_suite":"%%\r\na = [42 7 13 5 19];\r\ny_correct = [5 7 13 19 42];\r\nassert(isequal(firstClue(a),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":110,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-21T09:21:20.000Z","updated_at":"2026-03-26T03:52:14.000Z","published_at":"2025-10-21T09:21:20.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou discover an ancient parchment inside the college archives. It contains a jumbled sequence of numbers that seems meaningless — until you notice faint MATLAB-like symbols next to it!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour first task is to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edecode the clue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e by arranging the numbers in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eascending order\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The smallest number might mark the beginning of the treasure trail.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a row vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return another vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e containing all elements of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e sorted in increasing order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43079,"title":"Check if two matrices are permutations of each other","description":"Your function should return true for the elements of one matrix is the permutation of the other matrix:\r\n\r\n  x = [1 2 3; 4 5 6; 7 8 9]\r\n  y = [3 5 6; 7 1 2; 4 9 8]\r\n\r\nor \r\n\r\n  x = [1 2; 3 4; 5 6]\r\n  y = [1 2 3; 4 5 6]\r\n\r\nPlease note that the matrices can have different shapes or sizes!","description_html":"\u003cp\u003eYour function should return true for the elements of one matrix is the permutation of the other matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = [1 2 3; 4 5 6; 7 8 9]\r\ny = [3 5 6; 7 1 2; 4 9 8]\r\n\u003c/pre\u003e\u003cp\u003eor\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = [1 2; 3 4; 5 6]\r\ny = [1 2 3; 4 5 6]\r\n\u003c/pre\u003e\u003cp\u003ePlease note that the matrices can have different shapes or sizes!\u003c/p\u003e","function_template":"function isPerm = isPermute(x,y)\r\n    isPerm = true;\r\nend","test_suite":"%%\r\nx = [1 2 3; 4 5 6; 7 8 9]\r\ny = [3 5 6; 7 1 2; 4 9 8]\r\nisPerm = true;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = [1 2; 4 5; 7 8];\r\ny = x';\r\nisPerm = true;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = 1:50;\r\ny = randperm(50);\r\nisPerm = true;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = 2:51;\r\ny = randperm(50);\r\nisPerm = false;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = [1 2 3; 4 5 6; 7 8 9]\r\ny = [3 5; 7 1; 4 9]\r\nisPerm = false;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":25354,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":57,"test_suite_updated_at":"2016-10-05T21:51:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:47:13.000Z","updated_at":"2026-03-02T09:07:38.000Z","published_at":"2016-10-05T21:47:13.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour function should return true for the elements of one matrix is the permutation of the other matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = [1 2 3; 4 5 6; 7 8 9]\\ny = [3 5 6; 7 1 2; 4 9 8]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eor\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = [1 2; 3 4; 5 6]\\ny = [1 2 3; 4 5 6]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease note that the matrices can have different shapes or sizes!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44266,"title":"Sort the prime numbers in each row of a matrix","description":"Considering a 3x3 matrix A, sort the prime numbers of each row in ascending order. For exemple:\r\n\r\n  \r\n      input A=[5 8 2 4;\r\n               1 11 1 5]\r\n  \r\n  output B=[2 8 5 4;\r\n            1 5 1 11]\r\n  \r\n\r\nYou don't have to sort the other numbers, just the prime numbers.\r\nEnjoy!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 164.167px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.0833px; transform-origin: 407px 82.0833px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 292px 8px; transform-origin: 292px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eConsidering a matrix A, sort the prime numbers of each row in ascending order. For exemple:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 102.167px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 51.0833px; transform-origin: 404px 51.0833px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 92px 8.5px; transform-origin: 92px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 48px 8.5px; transform-origin: 48px 8.5px; \"\u003e      input \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 40px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 40px 8.5px; \"\u003eA=[5 8 2 4\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 96px 8.5px; transform-origin: 96px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e               1 11 1 5]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 72px 8.5px; transform-origin: 72px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 28px 8.5px; transform-origin: 28px 8.5px; \"\u003eoutput \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 40px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 40px 8.5px; \"\u003eB=[2 8 5 4\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 76px 8.5px; transform-origin: 76px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e          1 5 1 11]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 229px 8px; transform-origin: 229px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou don't have to sort the other numbers, just the prime numbers. Enjoy!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function B = SrtPrimesInRows(A)\r\n","test_suite":"%%\r\nA=[5 8 2 4;1 11 1 5] ;               \r\nB_correct = [2 8 5 4;1 5 1 11];\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=[2 7 5; 1 11 2;2 2 2];\r\nB_correct=[2 5 7;1 2 11;2 2 2];\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=[111 12 134;333 654 100000;112227 38 1];\r\nB_correct=A;\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=ones(4);\r\nA(2,1:4)=[11 59 7 23];\r\nB_correct=[1 1 1 1;7 11 23 59;1 1 1 1;1 1 1 1];\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=reshape(flip(primes(40)),3,4);\r\nB_correct= flipud(reshape(primes(40),3,4));\r\nassert(isequal(SrtPrimesInRows(A),B_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":140751,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":39,"test_suite_updated_at":"2021-04-20T15:13:52.000Z","rescore_all_solutions":false,"group_id":674,"created_at":"2017-07-20T15:29:29.000Z","updated_at":"2026-03-04T15:19:28.000Z","published_at":"2017-07-20T15:29:29.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsidering a matrix A, sort the prime numbers of each row in ascending order. For exemple:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[      input A=[5 8 2 4;\\n               1 11 1 5]\\n\\noutput B=[2 8 5 4;\\n          1 5 1 11]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou don't have to sort the other numbers, just the prime numbers. Enjoy!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":431,"title":"Indirect Sorting","description":"Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.\r\n\r\nExample:\r\n\r\n Input  = [1 2 3 4 5;\r\n           4 3 1 2 2]'\r\n\r\n Output = [3 4 5 2 1]'\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 142.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 71.3667px; transform-origin: 407px 71.3667px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373px 8px; transform-origin: 373px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAssume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.5px 8px; transform-origin: 28.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 84px 8.5px; transform-origin: 84px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e Input  = [1 2 3 4 5;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 88px 8.5px; transform-origin: 88px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e           4 3 1 2 2]'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 88px 8.5px; transform-origin: 88px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e Output = [3 4 5 2 1]'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sort2(x)\r\n","test_suite":"%%\r\nx = [1 2 3 4 5;4 3 1 2 2]';\r\ny_correct = [3 4 5 2 1]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [3 1 2;1 -1 0]';\r\ny_correct = [1 2 3]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [7 2 1 5 10 3 6; 2 8 3 5 7 9 10]';\r\ny_correct = [7 1 5 10 2 3 6]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [1:10;10:-1:1]';\r\ny_correct = [10:-1:1]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [13 2 23 7 29 5 19 17 3 11; 13 8 16 11 17 10 15 14 9 12]';\r\ny_correct = primes(30)';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = reshape(magic(4),[],2);\r\ny_correct = [14 16 9 11 5 7 2 4]';\r\nassert(isequal(sort2(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":1939,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":316,"test_suite_updated_at":"2021-04-26T10:01:18.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2012-03-01T15:09:37.000Z","updated_at":"2026-03-16T10:24:51.000Z","published_at":"2012-03-01T15:09:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAssume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  = [1 2 3 4 5;\\n           4 3 1 2 2]'\\n\\n Output = [3 4 5 2 1]']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":61024,"title":"The Case of the Missing Prototype – Restore the Correct Frame Order from the Corrupted Security Camera Footage","description":"You’ve finally recovered the security camera footage from the Innovation Lab,but the system malfunctioned and stored frames in the wrong order.Each frame is represented by a number in the vector frames.Reordering the footage might reveal who entered the lab that night!\r\nYour task is to restore the video to its proper sequence by arranging all frame numbers in ascending order.\r\nReturn the corrected vector of frame numbers.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 61.5px; transform-origin: 408px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 31.5px; text-align: left; transform-origin: 385px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou’ve finally recovered the security camera footage from the Innovation Lab,but the system malfunctioned and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003estored frames in the wrong order\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.Each frame is represented by a number in the vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eframes\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.Reordering the footage might reveal who entered the lab that night!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYour task is to restore the video to its proper sequence by arranging all frame numbers in \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eascending order\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn the corrected vector of frame numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = restoreFrames(frames)\r\n  y = x;\r\nend","test_suite":"%%\r\nframes = [3 1 4 2];\r\ny_correct = [1 2 3 4];\r\nassert(isequal(restoreFrames(frames),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":52,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-20T16:50:43.000Z","updated_at":"2026-04-03T03:53:05.000Z","published_at":"2025-10-20T16:50:43.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou’ve finally recovered the security camera footage from the Innovation Lab,but the system malfunctioned and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estored frames in the wrong order\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.Each frame is represented by a number in the vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eframes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.Reordering the footage might reveal who entered the lab that night!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task is to restore the video to its proper sequence by arranging all frame numbers in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eascending order\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the corrected vector of frame numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":47508,"title":"Convert sorting indices to ranks","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe second output of sort() is the sorting index vector, telling where the corresponding element in the sorted vector was in the raw vector. However sometimes we want to know where the elements of the raw vector goes into the sorted vector, i.e., ranks.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCan you find the shortest solution?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function Ranks = SortingIndices2Ranks(SortingIndices)\r\n  Ranks=SortingIndices;\r\nend","test_suite":"%%\r\nRawVector=rand(10,1);\r\n[SortedVector,SortingIndices]=sort(RawVector);\r\nRanks=SortingIndices2Ranks(SortingIndices);\r\nassert(isequal(SortedVector(Ranks),RawVector));","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":362068,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-11-15T04:05:17.000Z","updated_at":"2025-11-28T17:59:25.000Z","published_at":"2020-11-15T04:05:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe second output of sort() is the sorting index vector, telling where the corresponding element in the sorted vector was in the raw vector. However sometimes we want to know where the elements of the raw vector goes into the sorted vector, i.e., ranks.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCan you find the shortest solution?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":54910,"title":"Vector slither sort!","description":"Sort a numeric vector in the following format:\r\n[largest value, smallest value, second largest value, second smallest value, etc.]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 140px 8px; transform-origin: 140px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort a numeric vector in the following format:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 251.5px 8px; transform-origin: 251.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e[largest value, smallest value, second largest value, second smallest value, etc.]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = slither_sort(x)\r\n    y = x\r\nend","test_suite":"%% TEST 1\r\nx = [1,3,2,5,6];\r\ny_correct = [6,1,5,2,3];\r\nassert(isequal(slither_sort(x),y_correct))\r\n%% TEST 2\r\nx = [5,2,6,1,6];\r\ny_correct = [6,1,6,2,5];\r\nassert(isequal(slither_sort(x),y_correct))\r\n%% TEST 3\r\nx = [5,1,8,9];\r\ny_correct = [9,1,8,5];\r\nassert(isequal(slither_sort(x),y_correct))\r\n%% TEST 4\r\nx = -5:5;\r\ny_correct = [5,-5,4,-4,3,-3,2,-2,1,-1,0];\r\nassert(isequal(slither_sort(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2435125,"edited_by":223089,"edited_at":"2022-08-20T17:28:03.000Z","deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":"2022-08-20T17:28:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-07-12T15:20:17.000Z","updated_at":"2026-03-06T12:26:36.000Z","published_at":"2022-07-12T15:20:17.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a numeric vector in the following format:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e[largest value, smallest value, second largest value, second smallest value, etc.]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43609,"title":"Sort rows of a matrix","description":"Sort rows of matrix A in an ascending order according to the last column\r\n\r\nExample input:\r\n\r\n  A = [1 2 3;7 8 9;4 5 6];\r\n\r\nExample output:\r\n\r\n  A = [1 2 3;4 5 6;7 8 9];\r\n","description_html":"\u003cp\u003eSort rows of matrix A in an ascending order according to the last column\u003c/p\u003e\u003cp\u003eExample input:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eA = [1 2 3;7 8 9;4 5 6];\r\n\u003c/pre\u003e\u003cp\u003eExample output:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eA = [1 2 3;4 5 6;7 8 9];\r\n\u003c/pre\u003e","function_template":"function y = your_fcn_name(A)\r\n y = ?;\r\nend","test_suite":"%%\r\nA = magic(5);\r\ny_correct = [10 12 19 21  3;\r\n             11 18 25  2  9;\r\n             17 24  1  8 15;\r\n             23  5  7 14 16;\r\n              4  6 13 20 22];\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = 1:5;\r\ny_correct = A;\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = [1:4; 9:12; 13:16; 5:8];\r\ny_correct = reshape((1:16),[4,4])';\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = (1:10)';\r\ny_correct = A;\r\nind = rand(10,1); [~,indA] = sort(ind); A = A(indA);\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = [3:7; 10:-1:6; -4:0; 2:-1:-2];\r\ny_correct = flipud(A);\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":97,"test_suite_updated_at":"2016-12-05T18:47:25.000Z","rescore_all_solutions":false,"group_id":24,"created_at":"2016-10-24T15:59:33.000Z","updated_at":"2026-04-01T07:37:12.000Z","published_at":"2016-10-24T15:59:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort rows of matrix A in an ascending order according to the last column\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample input:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[A = [1 2 3;7 8 9;4 5 6];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample output:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[A = [1 2 3;4 5 6;7 8 9];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45508,"title":"AK Sorting according to given order","description":"Conventional ascending order of one digit number is [ 0, 1, 2, ......9]. Now this order is changed and stored in vector a. For example in a vector a = [3 8 7 5 0 9 2 1 6 4], first element 3 denotes the lowest value equal to 0 like in conventional representation and last element 4 denotes the highest value equal to 9 in conventional representation. \r\nAnother vector b is unsorted one. You need to sort the vector b according the new order expressed by vector a. \r\nFor a given vector b =[ 2 4 5 5 3 3 3 9 0] the sorted sequence is [3 3 3 5 5 0 9 2 4] and which should be stored in another vector named c.\r\n\r\nExample :\r\na= [ 3 8 7 5 0 9 2 1 6 4] % In this order '3' is considered as the smallest number and '4' is considered as largest number.\r\nb= [ 2 4 5 5 3 3 3 9 0] % This sequence is to be sorted according to the order in 'a'.\r\n\r\ntherefore, The should be,\r\nc=[3 3 3 5 5 0 9 2 4]\r\n \r\n\r\nComment: Consider both a \u0026 b are made using the digits from 0 to 9 only\r\n","description_html":"\u003cp\u003eConventional ascending order of one digit number is [ 0, 1, 2, ......9]. Now this order is changed and stored in vector a. For example in a vector a = [3 8 7 5 0 9 2 1 6 4], first element 3 denotes the lowest value equal to 0 like in conventional representation and last element 4 denotes the highest value equal to 9 in conventional representation. \r\nAnother vector b is unsorted one. You need to sort the vector b according the new order expressed by vector a. \r\nFor a given vector b =[ 2 4 5 5 3 3 3 9 0] the sorted sequence is [3 3 3 5 5 0 9 2 4] and which should be stored in another vector named c.\u003c/p\u003e\u003cp\u003eExample :\r\na= [ 3 8 7 5 0 9 2 1 6 4] % In this order '3' is considered as the smallest number and '4' is considered as largest number.\r\nb= [ 2 4 5 5 3 3 3 9 0] % This sequence is to be sorted according to the order in 'a'.\u003c/p\u003e\u003cp\u003etherefore, The should be,\r\nc=[3 3 3 5 5 0 9 2 4]\u003c/p\u003e\u003cp\u003eComment: Consider both a \u0026 b are made using the digits from 0 to 9 only\u003c/p\u003e","function_template":"function c = ak_sorting(a,b)\r\n  c = a+b;\r\nend","test_suite":"%%\r\na = [ 3 8 7 5 0 9 2 1 6 4];\r\nb= [ 2 4 5 5 3 3 3 9 0];\r\nc_correct =[3,3,3,5,5,0,9,2,4];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n%%\r\na = [ 0 1 2 3 4 5 6 7 8 9];\r\nb= [ 5 6 7 3 5 1 9 0 5 6 7 8 2 4 5];\r\nc_correct = [0 1 2 3 4 5 5 5 5 6 6 7 7 8 9];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n%%\r\na = [ 9 8 7 6 5 4 3 2 1 0];\r\nb= [3 4 1 2 3 4 1 2 3 4 1 2];\r\nc_correct = [4 4 4 3 3 3 2 2 2 1 1 1];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n%%\r\na = [4 5 7 8 0 3 1 2 9 6];\r\nb= [5 4 3 8 7 6 5 4 3 5 3 2 1 0 9 1];\r\nc_correct = [4 4 5 5 5 7 8 0 3 3 3 1 1 2 9 6];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363758,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-05-11T08:49:51.000Z","updated_at":"2026-02-02T20:15:48.000Z","published_at":"2020-05-11T09:19:01.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConventional ascending order of one digit number is [ 0, 1, 2, ......9]. Now this order is changed and stored in vector a. For example in a vector a = [3 8 7 5 0 9 2 1 6 4], first element 3 denotes the lowest value equal to 0 like in conventional representation and last element 4 denotes the highest value equal to 9 in conventional representation. Another vector b is unsorted one. You need to sort the vector b according the new order expressed by vector a. For a given vector b =[ 2 4 5 5 3 3 3 9 0] the sorted sequence is [3 3 3 5 5 0 9 2 4] and which should be stored in another vector named c.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample : a= [ 3 8 7 5 0 9 2 1 6 4] % In this order '3' is considered as the smallest number and '4' is considered as largest number. b= [ 2 4 5 5 3 3 3 9 0] % This sequence is to be sorted according to the order in 'a'.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003etherefore, The should be, c=[3 3 3 5 5 0 9 2 4]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eComment: Consider both a \u0026amp; b are made using the digits from 0 to 9 only\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44899,"title":"D'Hondt Method of Proportional-Representation","description":"The D'Hondt method is a proportional representational method for allocating seats to parties in an election.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/D%27Hondt_method\u003e\r\n\r\nTake a vector of *votes* cast for a number of parties and the total number of *seats* to be won.  Return a vector of the same size showing the *allocation* of the seats won.\r\n\r\nThe process is:\r\n\r\n# Allocate 1 seat to the party with the most votes\r\n# Divide that party's _original_ number of votes by the number of seats allocated to it + 1.\r\n# Repeat until all seats have been allocated\r\n\r\nNote: the total number of seats to be won will always be a positive integer and no ties will need to be resolved to allocate the seats.","description_html":"\u003cp\u003eThe D'Hondt method is a proportional representational method for allocating seats to parties in an election.\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/D%27Hondt_method\"\u003ehttps://en.wikipedia.org/wiki/D%27Hondt_method\u003c/a\u003e\u003c/p\u003e\u003cp\u003eTake a vector of \u003cb\u003evotes\u003c/b\u003e cast for a number of parties and the total number of \u003cb\u003eseats\u003c/b\u003e to be won.  Return a vector of the same size showing the \u003cb\u003eallocation\u003c/b\u003e of the seats won.\u003c/p\u003e\u003cp\u003eThe process is:\u003c/p\u003e\u003col\u003e\u003cli\u003eAllocate 1 seat to the party with the most votes\u003c/li\u003e\u003cli\u003eDivide that party's \u003ci\u003eoriginal\u003c/i\u003e number of votes by the number of seats allocated to it + 1.\u003c/li\u003e\u003cli\u003eRepeat until all seats have been allocated\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eNote: the total number of seats to be won will always be a positive integer and no ties will need to be resolved to allocate the seats.\u003c/p\u003e","function_template":"function allocation = dHondt(votes,seats)\r\n  allocation = [];\r\nend","test_suite":"%%\r\nvotes = [100];\r\nseats = 1;\r\nv_c   = 1;\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\nvotes = [30,40,60,50];\r\nseats = 1;\r\nv_c   = [0,0,1,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\nvotes = [428010,363033,330470,75648,71464];\r\nseats = 7;\r\nv_c   = [3,2,2,0,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\nvotes = [80000,30000,100000,20000];\r\nseats = 8;\r\nv_c   = [3,1,4,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\n\r\nvotes = [100,800,1000,800,600,100];\r\nseats = 9;\r\nv_c   = [0,2,3,2,2,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":301584,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-05-17T09:23:47.000Z","updated_at":"2025-11-27T19:15:20.000Z","published_at":"2019-10-14T19:49:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe D'Hondt method is a proportional representational method for allocating seats to parties in an election.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/D%27Hondt_method\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/D%27Hondt_method\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake a vector of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003evotes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e cast for a number of parties and the total number of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eseats\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be won. Return a vector of the same size showing the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eallocation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of the seats won.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe process is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAllocate 1 seat to the party with the most votes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivide that party's\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoriginal\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e number of votes by the number of seats allocated to it + 1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRepeat until all seats have been allocated\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote: the total number of seats to be won will always be a positive integer and no ties will need to be resolved to allocate the seats.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1894,"title":"GJam 2014 China Rd A: Library Sorting (Large)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2924486/dashboard#s=p2 GJam 2014 China Sorting\u003e.  Subset of cases.\r\n\r\nThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations. \r\n\r\n*Input:* V   a vector\r\n\r\n*Output:* Vout  a sorted vector Odds Increasing/Evens Increasing\r\n\r\n*Example:*\r\n\r\nV= [-5 -12 87 2 88 20 11]\r\n\r\nVout=[-5 88 11 20 2 -12 87]\r\n\r\n\r\n*Contest Performance:*  Best Time to Complete: \u003c 10 minutes","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\"\u003eGJam 2014 China Sorting\u003c/a\u003e.  Subset of cases.\u003c/p\u003e\u003cp\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V   a vector\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Vout  a sorted vector Odds Increasing/Evens Increasing\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eV= [-5 -12 87 2 88 20 11]\u003c/p\u003e\u003cp\u003eVout=[-5 88 11 20 2 -12 87]\u003c/p\u003e\u003cp\u003e\u003cb\u003eContest Performance:\u003c/b\u003e  Best Time to Complete: \u0026lt; 10 minutes\u003c/p\u003e","function_template":"function vout=Sort_CH(v)\r\n vout=v;\r\nend","test_suite":"%%\r\ntic\r\nv=[1 ];\r\nvexp=[1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[2 1 ];\r\nvexp=[2 1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 ];\r\nvexp=[1 2 3 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 4 5 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[5 2 3 4 1 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[994 994 -981 -975 -971 980 -971 976 -969 -969 968 968 958 -963 -957 948 -955 932 926 -935 924 -931 -923 -917 922 -917 -909 -899 916 914 -899 -877 -871 -871 -867 -847 912 -829 912 -825 -819 -817 910 -811 -805 -803 -801 904 -791 -783 -745 -731 902 -725 -725 -715 900 896 -707 896 -705 -705 -693 -691 882 -687 -685 -683 -671 -663 882 -663 880 880 -651 -651 -637 876 -637 -623 -613 -605 -601 -577 -577 862 -571 -565 856 848 -559 -559 -555 -553 844 -551 840 828 -547 -539 -527 812 -525 806 802 -505 -503 -497 -497 -495 798 -493 -491 -483 -481 798 770 770 -481 770 762 758 -477 -469 -463 -457 756 -455 -451 -441 -439 -431 -429 752 -427 -413 -409 742 -403 726 -391 722 -389 -385 718 -379 -365 -363 -359 712 702 -355 -351 682 -347 682 674 672 -343 672 -325 664 -319 -319 -315 -309 -297 -287 -285 -279 662 658 -277 658 656 650 -275 644 -259 -259 -259 630 -255 -251 -245 -231 -231 -225 -221 -219 -215 628 616 -213 612 -209 -209 598 -207 -203 -193 594 -191 -165 594 574 -163 -137 -129 -129 -119 -119 -119 -113 -111 572 564 560 -101 -99 -93 -91 546 -91 546 -91 542 -67 534 -63 528 -57 -55 -55 -49 -39 -37 522 -35 -31 520 -29 -25 -21 -17 -15 -11 -11 514 510 500 -9 494 -5 15 17 490 23 490 484 33 476 33 47 464 49 59 63 77 462 462 77 460 458 77 77 81 444 444 95 442 97 99 105 105 107 111 113 117 434 424 420 119 133 416 408 394 380 376 135 143 143 376 374 147 368 175 342 338 338 336 185 187 195 195 336 197 197 334 201 326 203 316 312 312 308 308 300 211 286 219 219 237 239 247 249 251 253 259 265 273 284 277 262 258 283 285 287 289 297 248 242 303 305 319 327 335 351 357 385 385 238 232 220 397 399 401 210 403 407 210 210 409 204 411 200 415 425 425 200 429 198 429 198 196 192 190 186 433 435 441 451 463 473 473 182 483 182 495 176 170 154 507 507 150 148 509 529 533 148 130 128 124 112 539 96 551 555 70 561 70 565 577 581 581 585 599 70 609 58 56 611 44 613 44 621 625 625 36 627 28 26 2 627 637 647 651 0 685 689 689 689 0 693 693 693 0 -10 -14 -40 -42 -44 697 -56 705 707 715 -56 -64 715 719 -66 -66 721 729 729 731 741 741 763 763 -74 767 775 811 815 819 827 833 -78 845 845 -80 -82 847 847 847 851 867 -84 869 869 869 871 -86 873 -98 -98 -104 875 875 879 887 911 935 -118 935 -120 949 951 965 973 975 979 -128 -132 -138 -140 -150 -154 -154 -164 -172 -174 -188 -196 -198 -200 -204 -208 -214 -216 -224 -228 -238 -242 -242 -250 -260 -260 -280 -286 -294 -296 -298 -302 -304 -308 -324 -330 -336 -336 -340 -342 -342 -344 -352 -352 -360 -360 -364 -364 -366 -368 -370 -378 -384 -384 -384 -392 -392 -396 -402 -402 -406 -410 -410 -416 -420 -420 -420 -432 -436 -440 -442 -458 -462 -470 -478 -482 -494 -500 -502 -504 -514 -520 -524 -530 -532 -534 -546 -548 -550 -550 -552 -558 -560 -566 -572 -572 -594 -598 -600 -602 -616 -626 -632 -638 -640 -650 -652 -664 -666 -676 -676 -684 -694 -700 -704 -710 -714 -720 -728 -728 -732 -738 -750 -758 -758 -776 -778 -782 -792 -794 -798 -798 -808 -810 -812 -814 -814 -818 -826 -836 -846 -856 -858 -858 -858 -860 -866 -866 -886 -892 -896 -900 -902 -906 -910 -910 -910 -924 -926 -926 -934 -938 -940 -942 -944 -946 -952 -952 -966 -966 -968 -968 -976 ];\r\nvexp=[994 994 -981 -975 -971 980 -971 976 -969 -969 968 968 958 -963 -957 948 -955 932 926 -935 924 -931 -923 -917 922 -917 -909 -899 916 914 -899 -877 -871 -871 -867 -847 912 -829 912 -825 -819 -817 910 -811 -805 -803 -801 904 -791 -783 -745 -731 902 -725 -725 -715 900 896 -707 896 -705 -705 -693 -691 882 -687 -685 -683 -671 -663 882 -663 880 880 -651 -651 -637 876 -637 -623 -613 -605 -601 -577 -577 862 -571 -565 856 848 -559 -559 -555 -553 844 -551 840 828 -547 -539 -527 812 -525 806 802 -505 -503 -497 -497 -495 798 -493 -491 -483 -481 798 770 770 -481 770 762 758 -477 -469 -463 -457 756 -455 -451 -441 -439 -431 -429 752 -427 -413 -409 742 -403 726 -391 722 -389 -385 718 -379 -365 -363 -359 712 702 -355 -351 682 -347 682 674 672 -343 672 -325 664 -319 -319 -315 -309 -297 -287 -285 -279 662 658 -277 658 656 650 -275 644 -259 -259 -259 630 -255 -251 -245 -231 -231 -225 -221 -219 -215 628 616 -213 612 -209 -209 598 -207 -203 -193 594 -191 -165 594 574 -163 -137 -129 -129 -119 -119 -119 -113 -111 572 564 560 -101 -99 -93 -91 546 -91 546 -91 542 -67 534 -63 528 -57 -55 -55 -49 -39 -37 522 -35 -31 520 -29 -25 -21 -17 -15 -11 -11 514 510 500 -9 494 -5 15 17 490 23 490 484 33 476 33 47 464 49 59 63 77 462 462 77 460 458 77 77 81 444 444 95 442 97 99 105 105 107 111 113 117 434 424 420 119 133 416 408 394 380 376 135 143 143 376 374 147 368 175 342 338 338 336 185 187 195 195 336 197 197 334 201 326 203 316 312 312 308 308 300 211 286 219 219 237 239 247 249 251 253 259 265 273 284 277 262 258 283 285 287 289 297 248 242 303 305 319 327 335 351 357 385 385 238 232 220 397 399 401 210 403 407 210 210 409 204 411 200 415 425 425 200 429 198 429 198 196 192 190 186 433 435 441 451 463 473 473 182 483 182 495 176 170 154 507 507 150 148 509 529 533 148 130 128 124 112 539 96 551 555 70 561 70 565 577 581 581 585 599 70 609 58 56 611 44 613 44 621 625 625 36 627 28 26 2 627 637 647 651 0 685 689 689 689 0 693 693 693 0 -10 -14 -40 -42 -44 697 -56 705 707 715 -56 -64 715 719 -66 -66 721 729 729 731 741 741 763 763 -74 767 775 811 815 819 827 833 -78 845 845 -80 -82 847 847 847 851 867 -84 869 869 869 871 -86 873 -98 -98 -104 875 875 879 887 911 935 -118 935 -120 949 951 965 973 975 979 -128 -132 -138 -140 -150 -154 -154 -164 -172 -174 -188 -196 -198 -200 -204 -208 -214 -216 -224 -228 -238 -242 -242 -250 -260 -260 -280 -286 -294 -296 -298 -302 -304 -308 -324 -330 -336 -336 -340 -342 -342 -344 -352 -352 -360 -360 -364 -364 -366 -368 -370 -378 -384 -384 -384 -392 -392 -396 -402 -402 -406 -410 -410 -416 -420 -420 -420 -432 -436 -440 -442 -458 -462 -470 -478 -482 -494 -500 -502 -504 -514 -520 -524 -530 -532 -534 -546 -548 -550 -550 -552 -558 -560 -566 -572 -572 -594 -598 -600 -602 -616 -626 -632 -638 -640 -650 -652 -664 -666 -676 -676 -684 -694 -700 -704 -710 -714 -720 -728 -728 -732 -738 -750 -758 -758 -776 -778 -782 -792 -794 -798 -798 -808 -810 -812 -814 -814 -818 -826 -836 -846 -856 -858 -858 -858 -860 -866 -866 -886 -892 -896 -900 -902 -906 -910 -910 -910 -924 -926 -926 -934 -938 -940 -942 -944 -946 -952 -952 -966 -966 -968 -968 -976 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-979 990 -975 -973 -971 -955 990 -953 -943 -937 -925 -921 986 -917 -913 -911 -909 984 -905 -903 -901 -897 -897 -889 -877 -875 980 968 -875 -871 -861 966 -861 -859 -855 948 942 -823 -821 -811 -805 -805 -797 -795 -793 -793 -793 938 -791 936 -781 -779 936 924 -775 -775 -767 924 920 -757 -755 914 -755 -751 -751 -749 906 -749 906 -745 -745 902 -741 902 -737 898 -735 -729 -727 894 882 868 -723 -709 862 858 858 -705 842 842 838 -693 -681 -679 838 -665 -651 -641 -629 -627 836 -627 828 -623 -623 824 -617 -585 -575 -571 -563 816 -561 -561 -559 -559 -549 808 -539 -539 -535 796 -533 -533 -527 792 -525 788 -525 -521 -517 788 -517 -511 -511 -493 756 -491 756 752 -485 -477 736 -465 -455 -453 716 -451 -441 -429 714 712 712 -427 -407 710 -399 -393 -393 -391 -385 -381 710 -379 702 700 698 -371 -371 -371 -359 -349 684 -341 672 -339 -337 -331 -319 652 636 -315 636 -315 -303 630 630 630 -301 -301 -297 -297 630 -297 -295 -291 -287 -281 624 -267 -267 624 -255 624 -247 616 -247 608 -245 -243 -241 -237 -237 -233 -231 -225 -221 -205 -201 604 -193 602 -185 602 600 -175 -167 -167 598 594 594 -163 -143 -143 588 584 -139 582 578 -133 -121 -117 -103 -95 -91 -89 -65 -65 -55 574 -49 572 -45 572 -39 572 -39 -35 -35 570 -31 -23 -19 560 -7 560 548 7 542 7 9 532 11 11 31 33 37 532 55 532 522 71 77 520 506 504 500 85 91 91 496 494 91 490 93 93 95 448 105 448 440 107 109 111 117 436 125 416 125 404 129 133 384 137 139 141 143 378 378 143 374 364 362 360 147 147 151 352 157 352 338 159 169 181 336 187 203 332 205 330 207 207 219 223 326 318 229 308 231 231 298 294 239 292 239 243 253 292 257 259 261 273 286 284 275 281 287 295 295 297 297 299 307 307 311 313 313 282 278 276 272 264 327 250 329 333 248 343 246 343 242 349 351 353 357 359 363 377 379 381 385 242 385 385 240 389 226 226 401 226 403 405 417 419 226 429 429 429 431 222 461 463 216 477 481 483 483 214 495 204 198 188 497 507 507 184 184 517 519 531 182 533 182 535 539 539 545 567 573 587 180 589 595 174 154 595 595 144 597 144 609 623 144 631 637 637 657 142 659 132 663 130 665 665 669 679 689 126 693 124 693 106 697 701 100 707 100 709 715 715 98 721 723 733 88 737 72 66 52 52 50 40 737 749 749 34 755 759 767 34 769 32 771 26 26 26 773 26 779 14 783 8 0 787 791 0 791 793 0 793 0 815 817 819 819 -10 819 819 819 821 821 823 827 -14 827 831 845 -38 859 861 -42 865 873 877 881 891 893 909 -44 -50 911 913 915 921 923 935 945 945 951 -50 -52 -54 953 -64 -66 -68 -80 959 961 -82 -84 -92 967 975 -98 -98 -106 -110 -110 -112 -122 -126 -140 -140 -144 -148 -154 -154 -154 -154 -162 -162 -168 -172 -182 -182 -204 -204 -208 -220 -220 -228 -232 -240 -248 -252 -254 -256 -256 -264 -266 -276 -280 -286 -286 -286 -294 -294 -294 -296 -300 -300 -300 -306 -310 -312 -314 -314 -320 -346 -346 -362 -362 -366 -368 -368 -370 -378 -380 -380 -384 -392 -392 -410 -410 -412 -424 -430 -430 -434 -434 -434 -436 -436 -438 -438 -442 -444 -444 -448 -462 -468 -480 -488 -494 -506 -512 -512 -518 -530 -530 -536 -536 -536 -546 -546 -548 -550 -554 -556 -560 -560 -578 -580 -590 -590 -596 -596 -598 -598 -610 -612 -616 -616 -618 -626 -630 -634 -636 -638 -640 -642 -644 -644 -644 -648 -652 -654 -664 -674 -674 -686 -698 -700 -702 -708 -714 -714 -716 -718 -722 -726 -728 -728 -740 -742 -744 -750 -752 -756 -762 -766 -766 -768 -770 -770 -770 -778 -778 -780 -782 -786 -786 -792 -792 -798 -806 -810 -812 -820 -828 -844 -858 -858 -858 -860 -872 -874 -880 -882 -882 -888 -888 -890 -896 -902 -910 -912 -924 -924 -936 -938 -956 -956 -968 -980 -980 -980 -982 -988 -990 -994 -996 -998 ];\r\nvexp=[-979 990 -975 -973 -971 -955 990 -953 -943 -937 -925 -921 986 -917 -913 -911 -909 984 -905 -903 -901 -897 -897 -889 -877 -875 980 968 -875 -871 -861 966 -861 -859 -855 948 942 -823 -821 -811 -805 -805 -797 -795 -793 -793 -793 938 -791 936 -781 -779 936 924 -775 -775 -767 924 920 -757 -755 914 -755 -751 -751 -749 906 -749 906 -745 -745 902 -741 902 -737 898 -735 -729 -727 894 882 868 -723 -709 862 858 858 -705 842 842 838 -693 -681 -679 838 -665 -651 -641 -629 -627 836 -627 828 -623 -623 824 -617 -585 -575 -571 -563 816 -561 -561 -559 -559 -549 808 -539 -539 -535 796 -533 -533 -527 792 -525 788 -525 -521 -517 788 -517 -511 -511 -493 756 -491 756 752 -485 -477 736 -465 -455 -453 716 -451 -441 -429 714 712 712 -427 -407 710 -399 -393 -393 -391 -385 -381 710 -379 702 700 698 -371 -371 -371 -359 -349 684 -341 672 -339 -337 -331 -319 652 636 -315 636 -315 -303 630 630 630 -301 -301 -297 -297 630 -297 -295 -291 -287 -281 624 -267 -267 624 -255 624 -247 616 -247 608 -245 -243 -241 -237 -237 -233 -231 -225 -221 -205 -201 604 -193 602 -185 602 600 -175 -167 -167 598 594 594 -163 -143 -143 588 584 -139 582 578 -133 -121 -117 -103 -95 -91 -89 -65 -65 -55 574 -49 572 -45 572 -39 572 -39 -35 -35 570 -31 -23 -19 560 -7 560 548 7 542 7 9 532 11 11 31 33 37 532 55 532 522 71 77 520 506 504 500 85 91 91 496 494 91 490 93 93 95 448 105 448 440 107 109 111 117 436 125 416 125 404 129 133 384 137 139 141 143 378 378 143 374 364 362 360 147 147 151 352 157 352 338 159 169 181 336 187 203 332 205 330 207 207 219 223 326 318 229 308 231 231 298 294 239 292 239 243 253 292 257 259 261 273 286 284 275 281 287 295 295 297 297 299 307 307 311 313 313 282 278 276 272 264 327 250 329 333 248 343 246 343 242 349 351 353 357 359 363 377 379 381 385 242 385 385 240 389 226 226 401 226 403 405 417 419 226 429 429 429 431 222 461 463 216 477 481 483 483 214 495 204 198 188 497 507 507 184 184 517 519 531 182 533 182 535 539 539 545 567 573 587 180 589 595 174 154 595 595 144 597 144 609 623 144 631 637 637 657 142 659 132 663 130 665 665 669 679 689 126 693 124 693 106 697 701 100 707 100 709 715 715 98 721 723 733 88 737 72 66 52 52 50 40 737 749 749 34 755 759 767 34 769 32 771 26 26 26 773 26 779 14 783 8 0 787 791 0 791 793 0 793 0 815 817 819 819 -10 819 819 819 821 821 823 827 -14 827 831 845 -38 859 861 -42 865 873 877 881 891 893 909 -44 -50 911 913 915 921 923 935 945 945 951 -50 -52 -54 953 -64 -66 -68 -80 959 961 -82 -84 -92 967 975 -98 -98 -106 -110 -110 -112 -122 -126 -140 -140 -144 -148 -154 -154 -154 -154 -162 -162 -168 -172 -182 -182 -204 -204 -208 -220 -220 -228 -232 -240 -248 -252 -254 -256 -256 -264 -266 -276 -280 -286 -286 -286 -294 -294 -294 -296 -300 -300 -300 -306 -310 -312 -314 -314 -320 -346 -346 -362 -362 -366 -368 -368 -370 -378 -380 -380 -384 -392 -392 -410 -410 -412 -424 -430 -430 -434 -434 -434 -436 -436 -438 -438 -442 -444 -444 -448 -462 -468 -480 -488 -494 -506 -512 -512 -518 -530 -530 -536 -536 -536 -546 -546 -548 -550 -554 -556 -560 -560 -578 -580 -590 -590 -596 -596 -598 -598 -610 -612 -616 -616 -618 -626 -630 -634 -636 -638 -640 -642 -644 -644 -644 -648 -652 -654 -664 -674 -674 -686 -698 -700 -702 -708 -714 -714 -716 -718 -722 -726 -728 -728 -740 -742 -744 -750 -752 -756 -762 -766 -766 -768 -770 -770 -770 -778 -778 -780 -782 -786 -786 -792 -792 -798 -806 -810 -812 -820 -828 -844 -858 -858 -858 -860 -872 -874 -880 -882 -882 -888 -888 -890 -896 -902 -910 -912 -924 -924 -936 -938 -956 -956 -968 -980 -980 -980 -982 -988 -990 -994 -996 -998 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-999 968 -991 -983 -977 -975 -973 952 -945 -935 -931 -919 -915 -905 -903 -885 -861 -847 940 -847 -841 938 -825 -821 -811 -809 936 924 902 -791 -779 -771 -767 884 884 880 -757 -735 -735 -717 -717 -715 -715 878 876 -699 -689 -665 -655 -655 -651 -581 -577 -567 -559 -555 -549 -547 -539 858 840 -515 -513 -507 -505 832 804 -477 -473 -467 -457 -443 802 -441 796 -407 -403 -389 792 -385 780 774 -383 -377 -325 -303 770 770 754 -281 742 -257 724 -251 -249 -237 -233 -227 -217 -211 -203 -195 712 704 -179 -177 -147 -119 -99 -77 -57 -49 700 682 670 -49 -39 -35 646 -31 640 -27 624 -5 15 23 31 620 33 588 580 35 53 578 65 560 65 67 71 75 77 79 546 522 506 91 95 103 504 109 117 119 121 478 125 143 145 155 462 163 165 167 175 458 456 454 452 181 189 195 215 229 231 231 257 448 257 448 265 273 432 283 420 325 341 408 343 365 365 397 399 399 411 415 423 423 429 386 435 382 380 437 443 364 364 455 467 364 354 479 330 495 505 505 306 537 539 278 561 563 567 567 573 595 619 258 623 625 647 665 693 699 713 719 721 258 733 737 749 757 819 252 839 238 853 855 224 863 867 871 182 883 893 897 182 182 903 176 150 903 913 136 919 931 933 128 965 967 118 975 993 108 102 98 88 60 42 30 18 14 12 -2 -10 -22 -22 -44 -48 -52 -52 -60 -70 -82 -88 -88 -110 -112 -116 -124 -130 -130 -132 -156 -174 -184 -204 -206 -210 -232 -234 -242 -252 -254 -264 -316 -330 -332 -338 -342 -348 -352 -354 -360 -364 -370 -372 -376 -380 -408 -428 -452 -462 -462 -462 -482 -486 -496 -506 -510 -516 -524 -526 -528 -532 -542 -572 -592 -604 -606 -624 -636 -642 -662 -670 -686 -686 -706 -728 -728 -736 -776 -788 -792 -792 -798 -804 -840 -902 -904 -910 -918 -952 -962 -962 -968 -978 -990 -994 -998 ];\r\nvexp=[-999 968 -991 -983 -977 -975 -973 952 -945 -935 -931 -919 -915 -905 -903 -885 -861 -847 940 -847 -841 938 -825 -821 -811 -809 936 924 902 -791 -779 -771 -767 884 884 880 -757 -735 -735 -717 -717 -715 -715 878 876 -699 -689 -665 -655 -655 -651 -581 -577 -567 -559 -555 -549 -547 -539 858 840 -515 -513 -507 -505 832 804 -477 -473 -467 -457 -443 802 -441 796 -407 -403 -389 792 -385 780 774 -383 -377 -325 -303 770 770 754 -281 742 -257 724 -251 -249 -237 -233 -227 -217 -211 -203 -195 712 704 -179 -177 -147 -119 -99 -77 -57 -49 700 682 670 -49 -39 -35 646 -31 640 -27 624 -5 15 23 31 620 33 588 580 35 53 578 65 560 65 67 71 75 77 79 546 522 506 91 95 103 504 109 117 119 121 478 125 143 145 155 462 163 165 167 175 458 456 454 452 181 189 195 215 229 231 231 257 448 257 448 265 273 432 283 420 325 341 408 343 365 365 397 399 399 411 415 423 423 429 386 435 382 380 437 443 364 364 455 467 364 354 479 330 495 505 505 306 537 539 278 561 563 567 567 573 595 619 258 623 625 647 665 693 699 713 719 721 258 733 737 749 757 819 252 839 238 853 855 224 863 867 871 182 883 893 897 182 182 903 176 150 903 913 136 919 931 933 128 965 967 118 975 993 108 102 98 88 60 42 30 18 14 12 -2 -10 -22 -22 -44 -48 -52 -52 -60 -70 -82 -88 -88 -110 -112 -116 -124 -130 -130 -132 -156 -174 -184 -204 -206 -210 -232 -234 -242 -252 -254 -264 -316 -330 -332 -338 -342 -348 -352 -354 -360 -364 -370 -372 -376 -380 -408 -428 -452 -462 -462 -462 -482 -486 -496 -506 -510 -516 -524 -526 -528 -532 -542 -572 -592 -604 -606 -624 -636 -642 -662 -670 -686 -686 -706 -728 -728 -736 -776 -788 -792 -792 -798 -804 -840 -902 -904 -910 -918 -952 -962 -962 -968 -978 -990 -994 -998 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[984 -997 -985 980 -983 978 -971 968 966 958 -969 952 -969 950 -963 944 -957 -955 936 -949 936 -949 -941 926 -935 -931 -917 -913 -913 -907 -903 -891 -861 924 922 918 916 912 902 894 -849 -847 -845 884 -837 878 878 -833 -827 876 862 836 834 832 822 822 -817 -809 -805 -803 -797 -791 804 786 784 -785 -773 778 -773 -763 -749 -749 -745 776 -741 -737 770 -737 -737 -735 -735 -731 -725 770 -723 -707 768 768 -707 762 760 -693 -683 -669 -667 750 746 740 -661 -649 -639 -637 -635 -609 730 728 -603 -595 728 -593 -589 -589 -585 -581 -581 728 -577 -567 -561 -547 724 -541 -539 -539 -539 -527 -525 -523 716 -517 -517 -515 714 702 702 676 -513 -487 -475 -471 672 -469 660 -467 652 -467 -467 634 632 -461 -457 -455 624 -455 -453 -451 624 618 -441 618 614 604 -439 -427 -413 -413 -409 -399 600 -399 594 -397 -387 594 -383 586 582 -377 580 580 -365 -359 -343 -337 578 -329 -327 -325 -323 -323 -315 -313 -301 -293 576 -275 576 572 572 572 -275 572 564 -273 -269 -259 560 -249 -249 560 -233 -233 552 -231 550 -219 -215 -215 -203 -197 -191 -189 -171 -169 -169 -163 -161 -159 -157 546 -155 -153 546 -151 -147 540 -147 -143 -143 -133 -131 -109 -109 -105 518 -105 -99 -99 -99 -99 -75 508 -73 -67 -63 -59 -55 508 -51 -39 -35 -35 506 504 -33 500 -21 -7 496 -7 3 7 11 11 486 482 11 13 15 27 33 35 35 37 37 41 53 55 65 65 77 97 101 113 117 121 476 125 129 472 133 135 468 143 143 151 462 151 151 167 462 462 167 167 167 169 462 189 189 191 193 460 193 195 207 215 217 221 225 225 231 239 460 239 249 448 446 253 265 265 273 283 442 297 299 301 440 307 311 436 436 434 319 325 331 428 418 331 416 333 339 339 349 416 349 359 359 363 363 363 377 385 395 399 399 403 407 417 408 423 431 435 402 400 445 451 453 396 465 467 386 374 364 477 481 364 497 507 507 511 360 511 511 523 531 551 569 577 344 583 587 340 589 330 318 316 595 312 609 310 310 609 609 611 611 611 615 619 621 623 631 637 308 284 284 278 272 272 262 254 641 651 667 252 252 244 669 671 683 242 685 242 234 234 689 234 693 228 693 701 713 224 220 214 713 715 721 725 212 733 735 735 735 210 206 206 737 741 741 198 196 745 753 763 767 196 771 196 188 186 184 182 771 182 783 789 803 811 817 817 823 835 837 839 182 839 841 847 849 853 182 853 861 182 180 865 869 873 875 879 180 176 881 881 891 897 176 174 172 172 897 897 911 921 923 160 156 923 152 144 144 931 943 138 134 122 118 114 112 949 112 949 112 949 953 959 959 959 961 961 104 971 92 90 88 975 979 991 993 80 78 72 72 70 70 66 58 46 40 36 28 28 14 10 2 0 0 0 0 0 -2 -10 -22 -28 -32 -40 -40 -44 -54 -54 -66 -76 -78 -82 -84 -94 -110 -126 -134 -140 -146 -148 -154 -154 -162 -166 -168 -174 -182 -182 -184 -196 -196 -202 -202 -204 -206 -206 -208 -216 -220 -220 -232 -234 -242 -244 -254 -270 -286 -286 -288 -292 -294 -300 -306 -314 -322 -328 -336 -336 -340 -352 -360 -366 -368 -368 -374 -378 -392 -396 -396 -396 -396 -404 -404 -408 -416 -420 -422 -422 -424 -424 -426 -426 -432 -434 -436 -440 -440 -442 -444 -448 -448 -450 -460 -462 -464 -472 -474 -476 -480 -494 -494 -504 -506 -514 -516 -520 -520 -542 -542 -562 -564 -564 -572 -572 -572 -574 -584 -590 -590 -594 -600 -608 -616 -616 -616 -618 -622 -624 -626 -628 -654 -656 -664 -664 -676 -680 -682 -686 -700 -700 -702 -704 -704 -712 -722 -728 -728 -728 -730 -742 -742 -758 -768 -770 -778 -780 -780 -780 -782 -782 -784 -784 -786 -790 -792 -792 -812 -816 -818 -822 -834 -856 -858 -858 -866 -870 -870 -876 -880 -884 -886 -894 -902 -916 -916 -918 -918 -924 -924 -926 -926 -928 -936 -940 -948 -952 -952 -956 -962 -966 -966 -968 -976 -988 -988 -990 -992 -998 ];\r\nvexp=[984 -997 -985 980 -983 978 -971 968 966 958 -969 952 -969 950 -963 944 -957 -955 936 -949 936 -949 -941 926 -935 -931 -917 -913 -913 -907 -903 -891 -861 924 922 918 916 912 902 894 -849 -847 -845 884 -837 878 878 -833 -827 876 862 836 834 832 822 822 -817 -809 -805 -803 -797 -791 804 786 784 -785 -773 778 -773 -763 -749 -749 -745 776 -741 -737 770 -737 -737 -735 -735 -731 -725 770 -723 -707 768 768 -707 762 760 -693 -683 -669 -667 750 746 740 -661 -649 -639 -637 -635 -609 730 728 -603 -595 728 -593 -589 -589 -585 -581 -581 728 -577 -567 -561 -547 724 -541 -539 -539 -539 -527 -525 -523 716 -517 -517 -515 714 702 702 676 -513 -487 -475 -471 672 -469 660 -467 652 -467 -467 634 632 -461 -457 -455 624 -455 -453 -451 624 618 -441 618 614 604 -439 -427 -413 -413 -409 -399 600 -399 594 -397 -387 594 -383 586 582 -377 580 580 -365 -359 -343 -337 578 -329 -327 -325 -323 -323 -315 -313 -301 -293 576 -275 576 572 572 572 -275 572 564 -273 -269 -259 560 -249 -249 560 -233 -233 552 -231 550 -219 -215 -215 -203 -197 -191 -189 -171 -169 -169 -163 -161 -159 -157 546 -155 -153 546 -151 -147 540 -147 -143 -143 -133 -131 -109 -109 -105 518 -105 -99 -99 -99 -99 -75 508 -73 -67 -63 -59 -55 508 -51 -39 -35 -35 506 504 -33 500 -21 -7 496 -7 3 7 11 11 486 482 11 13 15 27 33 35 35 37 37 41 53 55 65 65 77 97 101 113 117 121 476 125 129 472 133 135 468 143 143 151 462 151 151 167 462 462 167 167 167 169 462 189 189 191 193 460 193 195 207 215 217 221 225 225 231 239 460 239 249 448 446 253 265 265 273 283 442 297 299 301 440 307 311 436 436 434 319 325 331 428 418 331 416 333 339 339 349 416 349 359 359 363 363 363 377 385 395 399 399 403 407 417 408 423 431 435 402 400 445 451 453 396 465 467 386 374 364 477 481 364 497 507 507 511 360 511 511 523 531 551 569 577 344 583 587 340 589 330 318 316 595 312 609 310 310 609 609 611 611 611 615 619 621 623 631 637 308 284 284 278 272 272 262 254 641 651 667 252 252 244 669 671 683 242 685 242 234 234 689 234 693 228 693 701 713 224 220 214 713 715 721 725 212 733 735 735 735 210 206 206 737 741 741 198 196 745 753 763 767 196 771 196 188 186 184 182 771 182 783 789 803 811 817 817 823 835 837 839 182 839 841 847 849 853 182 853 861 182 180 865 869 873 875 879 180 176 881 881 891 897 176 174 172 172 897 897 911 921 923 160 156 923 152 144 144 931 943 138 134 122 118 114 112 949 112 949 112 949 953 959 959 959 961 961 104 971 92 90 88 975 979 991 993 80 78 72 72 70 70 66 58 46 40 36 28 28 14 10 2 0 0 0 0 0 -2 -10 -22 -28 -32 -40 -40 -44 -54 -54 -66 -76 -78 -82 -84 -94 -110 -126 -134 -140 -146 -148 -154 -154 -162 -166 -168 -174 -182 -182 -184 -196 -196 -202 -202 -204 -206 -206 -208 -216 -220 -220 -232 -234 -242 -244 -254 -270 -286 -286 -288 -292 -294 -300 -306 -314 -322 -328 -336 -336 -340 -352 -360 -366 -368 -368 -374 -378 -392 -396 -396 -396 -396 -404 -404 -408 -416 -420 -422 -422 -424 -424 -426 -426 -432 -434 -436 -440 -440 -442 -444 -448 -448 -450 -460 -462 -464 -472 -474 -476 -480 -494 -494 -504 -506 -514 -516 -520 -520 -542 -542 -562 -564 -564 -572 -572 -572 -574 -584 -590 -590 -594 -600 -608 -616 -616 -616 -618 -622 -624 -626 -628 -654 -656 -664 -664 -676 -680 -682 -686 -700 -700 -702 -704 -704 -712 -722 -728 -728 -728 -730 -742 -742 -758 -768 -770 -778 -780 -780 -780 -782 -782 -784 -784 -786 -790 -792 -792 -812 -816 -818 -822 -834 -856 -858 -858 -866 -870 -870 -876 -880 -884 -886 -894 -902 -916 -916 -918 -918 -924 -924 -926 -926 -928 -936 -940 -948 -952 -952 -956 -962 -966 -966 -968 -976 -988 -988 -990 -992 -998 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-891 962 792 -851 784 730 -789 -781 662 662 -765 -737 -713 644 -567 -525 -465 534 -451 526 454 -427 -399 -173 -15 454 -1 77 378 175 202 185 170 275 313 367 82 407 459 473 507 621 691 707 731 805 825 935 981 52 48 46 -10 -66 -162 -168 -192 -196 -218 -232 -262 -280 -288 -332 -358 -402 -438 -448 -490 -502 -516 -572 -590 -598 -832 -834 ];\r\nvexp=[-891 962 792 -851 784 730 -789 -781 662 662 -765 -737 -713 644 -567 -525 -465 534 -451 526 454 -427 -399 -173 -15 454 -1 77 378 175 202 185 170 275 313 367 82 407 459 473 507 621 691 707 731 805 825 935 981 52 48 46 -10 -66 -162 -168 -192 -196 -218 -232 -262 -280 -288 -332 -358 -402 -438 -448 -490 -502 -516 -572 -590 -598 -832 -834 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[990 988 -999 -995 -993 -993 -991 976 970 958 -989 -973 946 -965 -963 -957 -957 -941 938 -939 -937 -937 -913 -907 -901 938 938 924 -901 -893 924 -891 -889 918 -869 912 910 -869 -869 -845 -827 -811 -793 -741 906 868 -715 -715 844 836 -711 -709 812 -693 -693 -687 -665 808 786 774 -665 -663 -663 -615 -603 -593 -589 770 762 -587 756 -585 -581 -565 -565 -561 -555 -555 -553 -541 706 704 -539 -505 694 -503 -493 -455 -451 672 -427 -399 670 -385 658 -373 -359 656 -339 -335 654 -333 -327 636 -325 -313 -297 -297 -273 616 -263 -253 614 -251 604 590 -219 -209 550 -207 -203 -187 -185 -181 -177 -167 -159 546 -157 -145 -137 544 -135 -105 -77 -71 -67 -65 -41 540 -39 532 528 -37 526 -33 -31 -23 -21 -13 524 11 15 19 520 506 27 37 41 43 494 77 488 89 101 105 127 486 129 131 472 468 458 133 133 139 450 139 171 171 428 175 428 189 203 219 410 237 251 396 255 265 271 273 273 273 293 392 297 376 299 301 315 315 351 373 374 377 377 379 385 387 389 397 407 374 368 409 411 425 433 439 449 451 481 507 535 342 537 553 338 338 575 322 312 577 577 581 583 585 308 306 603 292 264 619 248 242 228 224 623 637 645 220 661 663 208 671 681 204 186 693 693 701 719 721 178 170 737 749 154 763 154 767 154 769 789 154 144 142 130 793 793 795 803 803 805 815 817 819 821 120 823 120 825 86 86 78 74 72 825 62 839 841 861 861 861 873 875 56 875 42 897 935 935 949 12 949 955 955 8 975 979 0 0 0 0 0 -52 -56 -60 -70 -70 -72 -94 -96 -98 -110 -110 -114 -116 -126 -126 -136 -158 -160 -176 -178 -182 -188 -196 -200 -206 -208 -208 -222 -224 -228 -276 -278 -296 -302 -316 -318 -324 -334 -346 -350 -350 -358 -364 -368 -370 -378 -378 -378 -386 -404 -416 -416 -418 -420 -432 -448 -462 -480 -482 -490 -502 -514 -516 -520 -546 -546 -546 -550 -564 -570 -570 -572 -574 -580 -600 -602 -624 -626 -626 -634 -650 -658 -658 -662 -686 -712 -716 -720 -726 -730 -732 -756 -756 -770 -780 -790 -798 -802 -824 -836 -882 -894 -906 -914 -914 -932 -950 -952 -966 -968 -978 -978 -990 -990 ];\r\nvexp=[990 988 -999 -995 -993 -993 -991 976 970 958 -989 -973 946 -965 -963 -957 -957 -941 938 -939 -937 -937 -913 -907 -901 938 938 924 -901 -893 924 -891 -889 918 -869 912 910 -869 -869 -845 -827 -811 -793 -741 906 868 -715 -715 844 836 -711 -709 812 -693 -693 -687 -665 808 786 774 -665 -663 -663 -615 -603 -593 -589 770 762 -587 756 -585 -581 -565 -565 -561 -555 -555 -553 -541 706 704 -539 -505 694 -503 -493 -455 -451 672 -427 -399 670 -385 658 -373 -359 656 -339 -335 654 -333 -327 636 -325 -313 -297 -297 -273 616 -263 -253 614 -251 604 590 -219 -209 550 -207 -203 -187 -185 -181 -177 -167 -159 546 -157 -145 -137 544 -135 -105 -77 -71 -67 -65 -41 540 -39 532 528 -37 526 -33 -31 -23 -21 -13 524 11 15 19 520 506 27 37 41 43 494 77 488 89 101 105 127 486 129 131 472 468 458 133 133 139 450 139 171 171 428 175 428 189 203 219 410 237 251 396 255 265 271 273 273 273 293 392 297 376 299 301 315 315 351 373 374 377 377 379 385 387 389 397 407 374 368 409 411 425 433 439 449 451 481 507 535 342 537 553 338 338 575 322 312 577 577 581 583 585 308 306 603 292 264 619 248 242 228 224 623 637 645 220 661 663 208 671 681 204 186 693 693 701 719 721 178 170 737 749 154 763 154 767 154 769 789 154 144 142 130 793 793 795 803 803 805 815 817 819 821 120 823 120 825 86 86 78 74 72 825 62 839 841 861 861 861 873 875 56 875 42 897 935 935 949 12 949 955 955 8 975 979 0 0 0 0 0 -52 -56 -60 -70 -70 -72 -94 -96 -98 -110 -110 -114 -116 -126 -126 -136 -158 -160 -176 -178 -182 -188 -196 -200 -206 -208 -208 -222 -224 -228 -276 -278 -296 -302 -316 -318 -324 -334 -346 -350 -350 -358 -364 -368 -370 -378 -378 -378 -386 -404 -416 -416 -418 -420 -432 -448 -462 -480 -482 -490 -502 -514 -516 -520 -546 -546 -546 -550 -564 -570 -570 -572 -574 -580 -600 -602 -624 -626 -626 -634 -650 -658 -658 -662 -686 -712 -716 -720 -726 -730 -732 -756 -756 -770 -780 -790 -798 -802 -824 -836 -882 -894 -906 -914 -914 -932 -950 -952 -966 -968 -978 -978 -990 -990 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-997 -995 994 -981 -977 -975 -971 988 -969 -931 -929 986 968 -903 -903 956 -897 -895 -887 -883 948 -879 -871 -871 -865 -863 946 -863 -861 -861 944 -853 934 924 -853 914 914 -847 -845 910 -829 898 -819 890 -807 -807 888 880 -803 -797 880 874 868 -793 860 842 -791 -783 840 -771 838 -767 -765 832 826 -763 826 -759 814 -759 -753 -733 812 -733 -729 -727 -727 -723 804 -715 802 -715 -707 798 -693 -671 -669 -669 -665 792 -663 -663 -663 -663 790 -653 -643 -635 -615 778 774 770 752 -611 -587 -579 746 -569 -569 -561 740 -555 -555 -553 -539 740 -537 -523 728 -517 -513 -509 -505 -497 -497 -493 -483 728 -479 -479 -475 -475 -467 722 722 -439 -431 -429 -425 706 -413 -407 704 702 690 678 676 -407 674 -393 -385 -385 672 670 -385 664 -383 -377 -371 -367 -355 -353 -353 -351 -347 658 -345 656 -327 652 -325 -323 650 616 -319 -315 616 604 602 602 -315 596 594 -313 572 572 566 -311 562 -295 -287 -285 -285 -275 -273 -273 -271 -261 -259 -259 -253 -249 550 -239 542 538 530 -233 -231 -231 -231 526 -217 520 -203 518 -189 518 -187 -183 516 -177 510 508 506 -173 -171 -145 506 504 504 -143 -143 494 492 482 -133 -129 478 474 -129 -125 -113 -111 -99 -93 -91 -81 472 -81 -77 -75 -63 -53 -45 -39 468 462 -39 -39 -13 7 9 13 21 23 35 43 452 43 450 49 49 51 55 67 71 448 73 77 77 81 91 446 93 97 101 105 115 119 121 125 428 151 422 151 171 173 181 187 420 189 195 410 400 392 197 207 211 211 392 221 221 376 376 223 225 364 229 231 231 342 235 241 340 241 336 332 245 326 247 253 322 253 312 255 308 261 269 306 279 291 286 309 286 315 323 266 258 323 329 341 343 256 347 357 379 381 385 397 401 403 403 407 421 427 244 427 429 242 429 433 433 238 433 437 441 234 220 208 443 208 196 451 455 459 467 469 186 182 178 469 475 483 483 505 511 513 539 539 557 559 561 565 168 168 567 166 156 575 156 585 593 154 150 593 148 144 136 130 595 597 597 609 613 617 120 633 637 639 647 661 671 118 114 112 679 110 679 679 110 681 683 687 106 98 98 693 693 695 98 76 699 72 699 713 715 721 64 727 62 731 733 62 56 735 739 741 745 52 749 749 52 28 22 20 759 14 759 763 8 763 765 767 8 6 4 0 0 0 0 0 0 767 767 785 791 801 -2 803 805 -8 -22 819 -24 825 833 -40 839 845 -44 847 847 847 -60 847 865 -64 865 871 909 -84 913 913 915 -84 919 -108 923 -110 929 933 933 -112 939 -114 949 963 965 -142 967 969 973 -144 -150 -156 981 983 987 989 993 995 995 -156 -164 -170 -174 -182 -188 -188 -208 -220 -240 -244 -252 -254 -262 -264 -268 -274 -280 -284 -286 -294 -318 -322 -330 -336 -338 -348 -350 -350 -356 -358 -370 -374 -384 -422 -422 -428 -432 -434 -434 -436 -436 -438 -440 -440 -458 -476 -476 -478 -482 -494 -494 -504 -504 -504 -506 -508 -512 -524 -526 -526 -528 -530 -532 -536 -538 -562 -564 -566 -570 -574 -580 -582 -592 -596 -596 -612 -614 -614 -616 -616 -618 -620 -620 -630 -632 -636 -642 -646 -648 -652 -656 -658 -658 -660 -664 -672 -672 -672 -690 -694 -714 -716 -730 -742 -748 -750 -768 -770 -770 -774 -778 -790 -794 -798 -806 -808 -812 -814 -822 -826 -830 -850 -858 -858 -878 -888 -892 -896 -900 -906 -910 -910 -910 -912 -922 -922 -926 -928 -950 -952 -976 -986 -986 ];\r\nvexp=[-997 -995 994 -981 -977 -975 -971 988 -969 -931 -929 986 968 -903 -903 956 -897 -895 -887 -883 948 -879 -871 -871 -865 -863 946 -863 -861 -861 944 -853 934 924 -853 914 914 -847 -845 910 -829 898 -819 890 -807 -807 888 880 -803 -797 880 874 868 -793 860 842 -791 -783 840 -771 838 -767 -765 832 826 -763 826 -759 814 -759 -753 -733 812 -733 -729 -727 -727 -723 804 -715 802 -715 -707 798 -693 -671 -669 -669 -665 792 -663 -663 -663 -663 790 -653 -643 -635 -615 778 774 770 752 -611 -587 -579 746 -569 -569 -561 740 -555 -555 -553 -539 740 -537 -523 728 -517 -513 -509 -505 -497 -497 -493 -483 728 -479 -479 -475 -475 -467 722 722 -439 -431 -429 -425 706 -413 -407 704 702 690 678 676 -407 674 -393 -385 -385 672 670 -385 664 -383 -377 -371 -367 -355 -353 -353 -351 -347 658 -345 656 -327 652 -325 -323 650 616 -319 -315 616 604 602 602 -315 596 594 -313 572 572 566 -311 562 -295 -287 -285 -285 -275 -273 -273 -271 -261 -259 -259 -253 -249 550 -239 542 538 530 -233 -231 -231 -231 526 -217 520 -203 518 -189 518 -187 -183 516 -177 510 508 506 -173 -171 -145 506 504 504 -143 -143 494 492 482 -133 -129 478 474 -129 -125 -113 -111 -99 -93 -91 -81 472 -81 -77 -75 -63 -53 -45 -39 468 462 -39 -39 -13 7 9 13 21 23 35 43 452 43 450 49 49 51 55 67 71 448 73 77 77 81 91 446 93 97 101 105 115 119 121 125 428 151 422 151 171 173 181 187 420 189 195 410 400 392 197 207 211 211 392 221 221 376 376 223 225 364 229 231 231 342 235 241 340 241 336 332 245 326 247 253 322 253 312 255 308 261 269 306 279 291 286 309 286 315 323 266 258 323 329 341 343 256 347 357 379 381 385 397 401 403 403 407 421 427 244 427 429 242 429 433 433 238 433 437 441 234 220 208 443 208 196 451 455 459 467 469 186 182 178 469 475 483 483 505 511 513 539 539 557 559 561 565 168 168 567 166 156 575 156 585 593 154 150 593 148 144 136 130 595 597 597 609 613 617 120 633 637 639 647 661 671 118 114 112 679 110 679 679 110 681 683 687 106 98 98 693 693 695 98 76 699 72 699 713 715 721 64 727 62 731 733 62 56 735 739 741 745 52 749 749 52 28 22 20 759 14 759 763 8 763 765 767 8 6 4 0 0 0 0 0 0 767 767 785 791 801 -2 803 805 -8 -22 819 -24 825 833 -40 839 845 -44 847 847 847 -60 847 865 -64 865 871 909 -84 913 913 915 -84 919 -108 923 -110 929 933 933 -112 939 -114 949 963 965 -142 967 969 973 -144 -150 -156 981 983 987 989 993 995 995 -156 -164 -170 -174 -182 -188 -188 -208 -220 -240 -244 -252 -254 -262 -264 -268 -274 -280 -284 -286 -294 -318 -322 -330 -336 -338 -348 -350 -350 -356 -358 -370 -374 -384 -422 -422 -428 -432 -434 -434 -436 -436 -438 -440 -440 -458 -476 -476 -478 -482 -494 -494 -504 -504 -504 -506 -508 -512 -524 -526 -526 -528 -530 -532 -536 -538 -562 -564 -566 -570 -574 -580 -582 -592 -596 -596 -612 -614 -614 -616 -616 -618 -620 -620 -630 -632 -636 -642 -646 -648 -652 -656 -658 -658 -660 -664 -672 -672 -672 -690 -694 -714 -716 -730 -742 -748 -750 -768 -770 -770 -774 -778 -790 -794 -798 -806 -808 -812 -814 -822 -826 -830 -850 -858 -858 -878 -888 -892 -896 -900 -906 -910 -910 -910 -912 -922 -922 -926 -928 -950 -952 -976 -986 -986 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-999 -993 -987 -983 -979 998 -975 -975 -973 994 -953 -951 -949 -947 -943 -935 -925 -923 -919 994 -919 -909 -901 986 970 970 966 -897 962 -897 952 -891 950 -885 938 -885 -877 924 916 -869 916 916 906 906 -855 -847 902 -845 -825 -819 898 -819 -815 -813 -813 -805 -803 -799 -797 892 -793 888 -791 -781 884 -779 878 -777 876 -773 -763 -763 872 870 -759 -757 870 862 -753 -749 -747 858 -745 854 -741 -737 -737 -735 -731 -727 -727 -721 -715 854 -715 -713 836 -711 -709 -709 -699 832 824 -693 -689 -689 822 818 816 -689 -689 -687 -683 -679 -677 812 -671 -671 802 -667 798 798 796 786 -667 -643 784 -637 -637 784 -637 -637 782 774 -635 -627 -615 -611 -609 -595 770 -595 766 -585 760 758 754 -573 -559 -559 -547 -531 744 -517 -517 -515 -511 744 -505 738 -495 -493 738 -455 -455 -439 738 -439 -435 734 -431 734 -429 -423 728 728 728 -411 -407 728 -403 -403 728 -401 706 -401 704 -395 -389 700 -385 700 -375 694 -375 -373 -369 692 -359 -351 -351 -341 -337 -335 -329 -327 -309 -301 -297 -297 -295 -289 686 -285 676 -281 -275 -273 674 670 668 -253 658 -253 -247 656 -241 -237 650 -235 -235 648 -227 644 644 -223 -221 -211 -209 638 626 -195 -189 -175 -169 624 624 622 -163 616 -155 -155 616 602 -143 -143 -137 -115 -99 -99 -95 -91 -89 594 -85 -75 -73 -63 -55 592 -49 592 572 -39 -37 572 570 -33 -23 568 -21 -3 564 -1 564 -1 562 560 558 -1 546 13 13 542 19 27 31 49 532 69 77 83 528 85 91 91 97 101 105 498 119 125 127 498 129 131 137 139 143 145 149 151 165 494 165 169 175 195 201 490 203 209 486 484 211 211 480 217 221 225 476 231 239 239 239 472 464 239 245 253 464 259 462 259 462 273 462 273 279 287 287 291 291 307 311 462 313 317 319 321 325 331 341 343 351 359 365 369 373 375 462 377 448 385 385 448 389 440 391 438 407 411 413 429 435 432 441 441 445 447 432 428 451 451 457 418 459 467 471 416 414 475 386 483 485 495 495 497 499 507 517 382 380 521 525 368 360 356 525 527 336 318 531 531 312 308 292 286 539 268 266 539 559 567 571 264 262 260 571 577 581 585 593 595 252 595 605 609 611 611 611 252 613 248 621 244 242 238 621 623 623 623 234 627 234 627 627 234 639 234 643 645 647 649 649 651 651 226 653 675 679 224 685 689 220 689 689 697 214 705 705 206 707 709 711 715 725 200 735 735 198 737 741 196 196 749 753 196 753 759 194 771 777 777 787 789 178 799 803 811 813 176 174 815 815 158 154 819 827 827 833 841 845 847 847 154 851 851 859 154 861 861 863 867 154 875 154 885 887 891 154 895 154 895 907 909 913 915 154 917 148 921 923 136 931 130 937 130 118 949 957 957 961 112 963 110 110 971 979 102 979 98 98 92 88 985 987 84 84 76 66 56 46 42 42 42 40 28 24 14 0 0 0 0 -2 -6 -26 -26 -26 -34 -34 -42 -42 -42 -44 -52 -58 -92 -94 -98 -100 -108 -110 -120 -126 -126 -134 -142 -144 -146 -150 -154 -154 -154 -154 -156 -156 -158 -174 -176 -182 -196 -228 -252 -252 -260 -264 -266 -266 -278 -278 -282 -286 -290 -296 -304 -310 -312 -316 -320 -326 -330 -334 -340 -342 -346 -348 -352 -362 -364 -374 -378 -382 -386 -388 -390 -392 -396 -404 -406 -406 -412 -414 -418 -426 -428 -432 -438 -442 -450 -462 -464 -468 -468 -472 -476 -486 -490 -492 -518 -520 -526 -526 -532 -532 -534 -546 -546 -546 -546 -548 -550 -560 -566 -572 -578 -580 -596 -596 -598 -614 -616 -620 -622 -640 -660 -664 -670 -672 -676 -686 -696 -698 -698 -702 -708 -726 -728 -728 -742 -750 -752 -754 -754 -764 -770 -770 -780 -784 -788 -792 -794 -806 -806 -818 -820 -822 -822 -824 -830 -852 -862 -864 -868 -868 -868 -872 -878 -896 -902 -906 -910 -910 -914 -922 -924 -924 -924 -924 -926 -936 -936 -938 -940 -956 -958 -962 -968 -988 -994 -994 -994 -994 -1000 ];\r\nvexp=[-999 -993 -987 -983 -979 998 -975 -975 -973 994 -953 -951 -949 -947 -943 -935 -925 -923 -919 994 -919 -909 -901 986 970 970 966 -897 962 -897 952 -891 950 -885 938 -885 -877 924 916 -869 916 916 906 906 -855 -847 902 -845 -825 -819 898 -819 -815 -813 -813 -805 -803 -799 -797 892 -793 888 -791 -781 884 -779 878 -777 876 -773 -763 -763 872 870 -759 -757 870 862 -753 -749 -747 858 -745 854 -741 -737 -737 -735 -731 -727 -727 -721 -715 854 -715 -713 836 -711 -709 -709 -699 832 824 -693 -689 -689 822 818 816 -689 -689 -687 -683 -679 -677 812 -671 -671 802 -667 798 798 796 786 -667 -643 784 -637 -637 784 -637 -637 782 774 -635 -627 -615 -611 -609 -595 770 -595 766 -585 760 758 754 -573 -559 -559 -547 -531 744 -517 -517 -515 -511 744 -505 738 -495 -493 738 -455 -455 -439 738 -439 -435 734 -431 734 -429 -423 728 728 728 -411 -407 728 -403 -403 728 -401 706 -401 704 -395 -389 700 -385 700 -375 694 -375 -373 -369 692 -359 -351 -351 -341 -337 -335 -329 -327 -309 -301 -297 -297 -295 -289 686 -285 676 -281 -275 -273 674 670 668 -253 658 -253 -247 656 -241 -237 650 -235 -235 648 -227 644 644 -223 -221 -211 -209 638 626 -195 -189 -175 -169 624 624 622 -163 616 -155 -155 616 602 -143 -143 -137 -115 -99 -99 -95 -91 -89 594 -85 -75 -73 -63 -55 592 -49 592 572 -39 -37 572 570 -33 -23 568 -21 -3 564 -1 564 -1 562 560 558 -1 546 13 13 542 19 27 31 49 532 69 77 83 528 85 91 91 97 101 105 498 119 125 127 498 129 131 137 139 143 145 149 151 165 494 165 169 175 195 201 490 203 209 486 484 211 211 480 217 221 225 476 231 239 239 239 472 464 239 245 253 464 259 462 259 462 273 462 273 279 287 287 291 291 307 311 462 313 317 319 321 325 331 341 343 351 359 365 369 373 375 462 377 448 385 385 448 389 440 391 438 407 411 413 429 435 432 441 441 445 447 432 428 451 451 457 418 459 467 471 416 414 475 386 483 485 495 495 497 499 507 517 382 380 521 525 368 360 356 525 527 336 318 531 531 312 308 292 286 539 268 266 539 559 567 571 264 262 260 571 577 581 585 593 595 252 595 605 609 611 611 611 252 613 248 621 244 242 238 621 623 623 623 234 627 234 627 627 234 639 234 643 645 647 649 649 651 651 226 653 675 679 224 685 689 220 689 689 697 214 705 705 206 707 709 711 715 725 200 735 735 198 737 741 196 196 749 753 196 753 759 194 771 777 777 787 789 178 799 803 811 813 176 174 815 815 158 154 819 827 827 833 841 845 847 847 154 851 851 859 154 861 861 863 867 154 875 154 885 887 891 154 895 154 895 907 909 913 915 154 917 148 921 923 136 931 130 937 130 118 949 957 957 961 112 963 110 110 971 979 102 979 98 98 92 88 985 987 84 84 76 66 56 46 42 42 42 40 28 24 14 0 0 0 0 -2 -6 -26 -26 -26 -34 -34 -42 -42 -42 -44 -52 -58 -92 -94 -98 -100 -108 -110 -120 -126 -126 -134 -142 -144 -146 -150 -154 -154 -154 -154 -156 -156 -158 -174 -176 -182 -196 -228 -252 -252 -260 -264 -266 -266 -278 -278 -282 -286 -290 -296 -304 -310 -312 -316 -320 -326 -330 -334 -340 -342 -346 -348 -352 -362 -364 -374 -378 -382 -386 -388 -390 -392 -396 -404 -406 -406 -412 -414 -418 -426 -428 -432 -438 -442 -450 -462 -464 -468 -468 -472 -476 -486 -490 -492 -518 -520 -526 -526 -532 -532 -534 -546 -546 -546 -546 -548 -550 -560 -566 -572 -578 -580 -596 -596 -598 -614 -616 -620 -622 -640 -660 -664 -670 -672 -676 -686 -696 -698 -698 -702 -708 -726 -728 -728 -742 -750 -752 -754 -754 -764 -770 -770 -780 -784 -788 -792 -794 -806 -806 -818 -820 -822 -822 -824 -830 -852 -862 -864 -868 -868 -868 -872 -878 -896 -902 -906 -910 -910 -914 -922 -924 -924 -924 -924 -926 -936 -936 -938 -940 -956 -958 -962 -968 -988 -994 -994 -994 -994 -1000 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[994 -969 988 986 -957 -931 966 -889 -889 -883 -881 -877 -877 960 -873 914 -861 912 -847 -845 -841 -835 900 -805 -803 -793 -793 886 864 -785 -765 -765 -737 -713 -713 -701 -661 -655 -621 840 -619 -615 -599 832 -595 -567 -553 828 -541 -497 -467 -455 -429 -419 -415 -387 794 -377 792 -375 -371 -365 -337 -333 -331 -321 -285 780 -285 762 -271 -263 758 -259 -257 732 728 -249 -235 -231 -231 -189 726 -189 -181 -175 698 -153 -149 696 684 -127 672 -119 -115 652 -115 -113 644 -93 -91 608 -91 602 -77 -49 -45 594 -35 -5 562 -3 11 540 538 518 506 41 43 506 57 111 121 474 123 161 177 191 203 207 217 217 247 259 269 273 468 464 442 297 303 319 321 333 343 349 420 418 353 410 397 406 427 384 427 429 384 455 455 467 378 370 493 505 364 525 364 533 348 336 539 541 583 589 611 330 316 619 627 647 651 681 717 719 308 725 739 757 767 282 777 274 779 797 847 264 262 252 853 873 242 933 947 969 971 979 232 208 182 999 999 174 170 138 132 126 110 108 98 98 70 44 44 22 4 0 0 0 -2 -22 -58 -66 -74 -94 -116 -148 -158 -182 -210 -214 -222 -226 -238 -248 -252 -256 -286 -310 -320 -336 -342 -370 -388 -402 -402 -416 -440 -440 -458 -460 -460 -490 -504 -514 -528 -560 -572 -588 -596 -600 -616 -638 -642 -654 -660 -676 -684 -702 -706 -708 -720 -726 -742 -746 -766 -786 -812 -832 -840 -846 -864 -910 -912 -916 -948 -966 -982 -986 -992 ];\r\nvexp=[994 -969 988 986 -957 -931 966 -889 -889 -883 -881 -877 -877 960 -873 914 -861 912 -847 -845 -841 -835 900 -805 -803 -793 -793 886 864 -785 -765 -765 -737 -713 -713 -701 -661 -655 -621 840 -619 -615 -599 832 -595 -567 -553 828 -541 -497 -467 -455 -429 -419 -415 -387 794 -377 792 -375 -371 -365 -337 -333 -331 -321 -285 780 -285 762 -271 -263 758 -259 -257 732 728 -249 -235 -231 -231 -189 726 -189 -181 -175 698 -153 -149 696 684 -127 672 -119 -115 652 -115 -113 644 -93 -91 608 -91 602 -77 -49 -45 594 -35 -5 562 -3 11 540 538 518 506 41 43 506 57 111 121 474 123 161 177 191 203 207 217 217 247 259 269 273 468 464 442 297 303 319 321 333 343 349 420 418 353 410 397 406 427 384 427 429 384 455 455 467 378 370 493 505 364 525 364 533 348 336 539 541 583 589 611 330 316 619 627 647 651 681 717 719 308 725 739 757 767 282 777 274 779 797 847 264 262 252 853 873 242 933 947 969 971 979 232 208 182 999 999 174 170 138 132 126 110 108 98 98 70 44 44 22 4 0 0 0 -2 -22 -58 -66 -74 -94 -116 -148 -158 -182 -210 -214 -222 -226 -238 -248 -252 -256 -286 -310 -320 -336 -342 -370 -388 -402 -402 -416 -440 -440 -458 -460 -460 -490 -504 -514 -528 -560 -572 -588 -596 -600 -616 -638 -642 -654 -660 -676 -684 -702 -706 -708 -720 -726 -742 -746 -766 -786 -812 -832 -840 -846 -864 -910 -912 -916 -948 -966 -982 -986 -992 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-991 -989 998 -987 -983 -973 996 982 980 -971 978 -965 -959 974 -957 -951 -947 966 -941 966 966 962 -931 -931 -909 -903 -895 -893 -889 -885 -883 944 -883 936 -869 912 -845 896 894 -845 -837 -833 -829 886 882 -817 880 -803 872 -791 -791 -777 -769 -765 -759 -753 870 -743 -729 864 -717 864 854 -711 -707 850 -695 -689 -683 840 826 -665 -661 -659 812 798 -659 766 -657 760 -653 -637 756 -631 -627 -621 -611 748 -609 -605 -605 -601 -597 -589 -573 -567 -541 -539 -539 740 730 -539 -535 -507 -483 728 -475 -469 714 -455 -453 710 704 -451 -447 -433 -433 -431 -421 -417 -417 686 -405 682 -403 680 -399 678 -391 672 -387 670 668 -385 660 -381 -381 636 -377 -367 -363 -353 -331 626 618 -325 -303 616 -299 -297 -291 584 -281 -277 578 578 572 570 -245 -243 -239 -231 -223 -221 -209 570 -205 -201 -185 -183 -175 -165 -163 -159 -157 568 -147 564 -139 562 -125 548 -117 544 542 -103 -101 528 -95 524 -95 -79 -71 -71 -61 -49 520 -41 -37 520 518 -33 -27 502 -25 490 -21 482 474 -17 474 -17 -9 -7 -7 7 13 15 446 17 23 446 31 35 440 35 39 45 49 49 426 59 418 406 67 91 404 93 103 388 105 107 113 388 117 119 121 123 131 141 143 143 161 173 173 179 378 195 358 197 203 231 257 356 263 271 273 275 277 287 297 338 301 303 338 305 323 325 336 330 369 381 399 322 308 407 308 413 308 296 419 419 296 425 439 292 445 280 451 451 260 451 453 246 469 469 469 483 246 495 242 501 242 511 517 232 212 529 539 206 180 178 539 178 549 549 553 559 561 561 565 567 573 585 585 595 607 623 633 641 657 683 689 719 727 733 735 741 759 168 779 783 166 164 791 807 817 819 823 861 865 869 869 162 903 907 138 907 913 913 917 923 132 132 941 130 953 957 126 122 965 971 981 985 993 995 104 98 98 94 88 88 86 80 78 76 68 66 66 60 58 52 36 36 22 16 0 0 0 -14 -20 -22 -26 -28 -52 -54 -56 -58 -70 -70 -72 -76 -118 -126 -126 -140 -140 -142 -154 -154 -168 -172 -174 -182 -188 -196 -196 -206 -208 -220 -220 -222 -226 -236 -262 -286 -300 -308 -308 -322 -322 -336 -342 -346 -366 -396 -396 -404 -444 -446 -450 -462 -462 -466 -468 -468 -486 -486 -490 -498 -498 -506 -520 -532 -546 -548 -588 -594 -594 -596 -596 -604 -608 -612 -616 -616 -616 -622 -622 -626 -626 -656 -656 -656 -664 -672 -680 -682 -682 -714 -718 -744 -750 -750 -756 -770 -788 -800 -806 -814 -816 -850 -858 -858 -864 -868 -868 -870 -882 -884 -910 -924 -928 -932 -942 -946 -950 -952 -980 -986 -988 ];\r\nvexp=[-991 -989 998 -987 -983 -973 996 982 980 -971 978 -965 -959 974 -957 -951 -947 966 -941 966 966 962 -931 -931 -909 -903 -895 -893 -889 -885 -883 944 -883 936 -869 912 -845 896 894 -845 -837 -833 -829 886 882 -817 880 -803 872 -791 -791 -777 -769 -765 -759 -753 870 -743 -729 864 -717 864 854 -711 -707 850 -695 -689 -683 840 826 -665 -661 -659 812 798 -659 766 -657 760 -653 -637 756 -631 -627 -621 -611 748 -609 -605 -605 -601 -597 -589 -573 -567 -541 -539 -539 740 730 -539 -535 -507 -483 728 -475 -469 714 -455 -453 710 704 -451 -447 -433 -433 -431 -421 -417 -417 686 -405 682 -403 680 -399 678 -391 672 -387 670 668 -385 660 -381 -381 636 -377 -367 -363 -353 -331 626 618 -325 -303 616 -299 -297 -291 584 -281 -277 578 578 572 570 -245 -243 -239 -231 -223 -221 -209 570 -205 -201 -185 -183 -175 -165 -163 -159 -157 568 -147 564 -139 562 -125 548 -117 544 542 -103 -101 528 -95 524 -95 -79 -71 -71 -61 -49 520 -41 -37 520 518 -33 -27 502 -25 490 -21 482 474 -17 474 -17 -9 -7 -7 7 13 15 446 17 23 446 31 35 440 35 39 45 49 49 426 59 418 406 67 91 404 93 103 388 105 107 113 388 117 119 121 123 131 141 143 143 161 173 173 179 378 195 358 197 203 231 257 356 263 271 273 275 277 287 297 338 301 303 338 305 323 325 336 330 369 381 399 322 308 407 308 413 308 296 419 419 296 425 439 292 445 280 451 451 260 451 453 246 469 469 469 483 246 495 242 501 242 511 517 232 212 529 539 206 180 178 539 178 549 549 553 559 561 561 565 567 573 585 585 595 607 623 633 641 657 683 689 719 727 733 735 741 759 168 779 783 166 164 791 807 817 819 823 861 865 869 869 162 903 907 138 907 913 913 917 923 132 132 941 130 953 957 126 122 965 971 981 985 993 995 104 98 98 94 88 88 86 80 78 76 68 66 66 60 58 52 36 36 22 16 0 0 0 -14 -20 -22 -26 -28 -52 -54 -56 -58 -70 -70 -72 -76 -118 -126 -126 -140 -140 -142 -154 -154 -168 -172 -174 -182 -188 -196 -196 -206 -208 -220 -220 -222 -226 -236 -262 -286 -300 -308 -308 -322 -322 -336 -342 -346 -366 -396 -396 -404 -444 -446 -450 -462 -462 -466 -468 -468 -486 -486 -490 -498 -498 -506 -520 -532 -546 -548 -588 -594 -594 -596 -596 -604 -608 -612 -616 -616 -616 -622 -622 -626 -626 -656 -656 -656 -664 -672 -680 -682 -682 -714 -718 -744 -750 -750 -756 -770 -788 -800 -806 -814 -816 -850 -858 -858 -864 -868 -868 -870 -882 -884 -910 -924 -928 -932 -942 -946 -950 -952 -980 -986 -988 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-295 -303 -181 -373 3 955 107 217 -418 89 37 186 29 -19 -459 -780 -990 -971 673 821 820 403 317 -844 104 187 403 910 897 -684 -440 259 555 -773 -28 -509 559 507 546 -394 602 889 -602 -945 717 -503 -931 56 5 -913 965 927 980 926 -255 960 -385 539 546 -187 -504 -138 -673 443 955 913 335 -902 -814 -182 564 -335 676 813 394 945 -234 -181 -445 11 -463 693 -346 -778 -383 -724 747 227 -554 897 -495 -139 623 98 -217 -845 153 461 298 -689 487 -466 698 -159 -569 439 786 80 -751 -366 259 528 955 704 -313 71 468 -9 -341 277 315 966 999 -138 -449 -869 636 951 -266 -417 -127 -429 385 -406 -395 -75 -802 -929 -377 -290 882 -554 -529 233 -979 830 330 -737 845 309 670 -415 341 339 479 -550 -139 -47 -357 627 351 320 39 -291 182 -956 882 455 -308 781 -151 -349 33 -506 149 -325 315 -895 273 943 143 -357 -968 -923 163 526 446 -505 -497 59 -580 -89 -161 -39 777 671 832 -939 -185 263 -473 -321 514 -351 -276 294 231 699 -429 899 29 -678 -402 -958 -88 938 -80 285 -553 203 925 -790 471 -684 271 420 -559 -15 -582 -81 22 600 -903 455 -285 914 -382 -692 319 -986 363 -23 795 253 -257 -467 211 -908 -559 845 -478 687 -515 387 134 931 203 -7 303 572 737 669 945 -547 379 911 -117 882 704 454 -269 -488 756 -567 -125 -59 715 265 147 429 243 574 -197 -523 -462 -987 937 -305 347 394 462 373 517 -673 640 532 -720 32 185 -821 -749 -727 106 308 -572 721 -34 -803 -613 537 836 -489 -658 168 331 -368 871 -602 399 992 729 -325 -173 -765 -793 -901 -728 -109 -705 -40 -825 972 -46 884 76 471 -814 -753 -169 837 -499 381 178 -363 509 -847 -855 359 65 149 -481 -468 89 417 814 -358 -357 5 91 -924 -738 765 -15 -881 -634 -303 -769 -105 225 -245 -109 -437 -165 625 704 964 539 659 -357 -373 889 173 825 -963 -627 -529 -700 537 851 6 273 -637 -840 -576 -343 -992 9 145 551 -447 870 286 88 -850 440 661 -729 -279 556 588 870 -110 -723 429 -759 -616 361 815 60 861 -522 -29 455 -91 -917 -781 -469 -89 406 -231 -569 289 -84 -847 -199 912 64 748 389 781 -224 -525 -504 287 -605 559 722 -775 -879 991 689 721 -504 -362 988 99 949 202 -931 -920 -284 -213 616 581 847 495 363 -418 608 49 -832 157 763 -203 -581 -689 -632 -231 -91 376 -309 -352 672 253 -301 418 885 85 321 812 501 -79 366 -249 -175 65 737 -849 -453 871 -468 868 919 952 425 351 -935 -301 -595 372 -155 -21 913 50 597 548 825 299 465 -501 249 -583 734 -983 -224 19 -218 476 -364 392 211 580 717 557 942 255 972 -88 -420 -763 -438 -721 351 -289 661 -741 904 -949 -954 -103 858 155 -251 -245 429 -149 -752 657 -781 -583 -224 -202 -771 525 442 978 -13 681 430 198 -623 937 -897 -910 -155 708 -383 -800 169 981 -910 7 -896 -544 633 -812 533 462 482 22 -231 251 415 -450 631 -631 234 -23 622 19 -175 -160 -638 868 -112 119 -203 671 520 490 273 -857 -842 -499 721 -77 273 993 181 910 -922 -421 -728 -627 -451 -279 -739 607 -839 -444 -910 56 -740 -715 923 -344 -825 -91 -690 728 -429 -104 393 -270 -788 -585 -507 -44 -663 905 -589 801 -681 473 430 -247 -957 468 676 -726 99 543 -179 314 96 283 -285 -871 15 759 545 510 437 123 -689 171 -335 -580 -403 -154 741 782 -416 857 -307 346 325 -109 -929 -325 -618 -243 -377 -231 370 -197 -598 -668 735 553 -506 -616 -90 119 -235 -853 -248 -313 65 136 -305 -476 -350 459 888 347 651 -737 -775 211 567 809 -411 -634 -178 92 -702 741 449 -703 -608 -438 -199 180 -978 -957 -308 -883 -993 -357 -845 -429 938 -367 679 912 755 233 -589 983 -537 523 975 -775 -754 -855 -676 295 651 -327 624 -514 -572 -906 150 504 24 946 552 834 -256 252 374 882 368 -920 -828 -696 -274 -294 898 -664 616 932 966 -728 86 912 -640 -636 -428 -364 470 -922 570 326 -206 -514 188 96 -412 -472 702 -156 -682 188 -462 560 -350 426 -2 -818 774 0 436 280 712 302 -26 -352 224 -290 -24 -630 -746 -418 692 -294 252 238 178 214 -858 -196 -672 846 968 0 972 312 700 -804 -858 -284 -690 216 -660 -210 504 -280 -822 -138 276 -438 -104 442 240 352 -252 460 -246 -180 66 -574 60 -922 760 -934 -86 -922 -82 -82 374 -84 158 242 216 530 -628 -386 -876 974 630 -528 -682 402 -242 752 -74 -704 98 462 344 252 800 920 -70 -994 -628 -220 852 -768 -282 -890 634 14 -266 848 428 580 -288 308 650 -518 -700 434 -872 -146 -950 500 -132 -254 -810 316 -376 580 630 -300 -688 242 46 -224 38 -716 12 84 642 -766 -992 -730 -568 1000 542 422 190 -744 796 -594 442 -938 616 -512 724 -72 -522 536 224 -804 252 32 704 -892 -728 806 -28 112 592 346 -256 210 -610 -374 872 918 102 -616 668 84 -546 -836 584 456 -810 -380 -910 420 -540 14 -628 -286 -40 -504 -224 686 890 -902 -294 -448 -672 198 ];\r\nvexp=[-993 -987 -983 -979 -971 -963 -957 -957 1000 -949 -945 992 -939 -935 -931 988 980 -931 -929 -929 978 -923 -917 974 972 -913 -903 972 -901 972 968 -897 -895 -883 966 -881 -879 -871 966 964 960 -869 952 -857 -855 -855 -853 946 -849 -847 -847 -845 942 938 -845 938 -839 -825 932 -825 926 920 -821 -803 -793 -781 -781 918 914 912 912 -775 912 -775 910 -775 910 -773 -771 -769 -765 -763 904 898 -759 890 -753 -751 888 -749 -741 -739 -737 884 -737 -729 -727 -723 882 -721 -715 882 882 -705 -703 -689 882 872 -689 870 -689 870 -681 868 -673 -673 868 -663 -637 -631 -627 858 -627 852 -623 -613 848 -605 846 -595 -589 -589 -585 836 -583 -583 834 -581 -569 832 830 820 -569 -567 -559 814 812 -559 -553 -547 806 -537 -529 -529 -525 800 -523 -515 -509 -507 -505 796 -503 -501 786 782 774 -499 760 -499 -497 -495 -489 756 -481 -473 -469 -467 -463 -459 -453 -451 752 -449 -447 748 734 -445 -437 -429 728 -429 -429 -429 -421 -417 724 -415 -411 -403 -395 -385 722 -383 712 708 -383 -377 -377 -373 -373 704 704 704 704 702 700 -367 -363 -357 -357 698 -357 692 -357 686 -357 -351 676 -349 676 672 -343 -341 -335 670 668 650 -335 642 -327 -325 -325 -325 -321 -313 -313 640 -309 -307 636 -305 -305 -303 634 -303 -301 -301 -295 630 -291 -289 -285 -285 -279 -279 -269 630 624 622 -257 616 616 -255 -251 -249 -247 -245 -245 -243 -235 616 -231 -231 608 -231 -231 -217 -213 602 600 -203 -203 -199 592 588 584 580 -199 -197 -197 -187 580 580 574 -185 572 -181 -181 -179 570 -175 564 560 -175 556 -173 552 -169 548 -165 -161 -159 -155 -155 -151 546 -149 -139 546 -139 542 536 532 530 -127 528 -125 -117 -109 -109 -109 526 -105 -103 -91 -91 -91 -89 -89 -81 520 -79 -77 514 510 -75 -59 -47 504 504 -39 -29 -23 500 -23 -21 -19 -15 -15 -13 -9 -7 3 490 482 5 5 7 9 11 15 19 19 29 29 476 33 37 470 39 49 468 468 59 462 65 65 65 71 462 462 460 456 454 85 89 89 446 442 442 442 91 99 99 440 107 119 436 119 434 123 143 145 147 149 149 153 430 155 157 163 430 169 171 428 426 422 173 181 420 185 420 187 203 203 418 211 211 211 217 225 406 402 394 227 231 394 233 392 376 233 374 243 249 251 253 374 372 253 370 255 259 259 263 265 368 271 273 366 273 352 346 273 273 346 277 283 285 344 287 289 330 295 299 303 309 315 315 317 326 320 319 316 321 325 331 335 339 314 341 347 347 312 351 308 351 351 359 361 363 363 308 373 302 379 298 294 286 280 381 276 385 387 252 389 252 252 252 393 242 399 403 403 415 417 242 425 240 429 238 429 429 437 439 443 234 449 455 455 224 224 455 459 216 216 461 465 214 210 471 471 473 202 479 198 487 198 495 501 190 507 188 188 509 186 517 182 180 178 523 525 533 178 537 537 168 539 158 539 543 150 136 134 112 545 551 553 106 104 555 557 102 559 559 567 581 597 607 98 98 623 96 625 627 631 633 651 651 96 92 88 86 657 659 84 661 661 84 80 669 76 671 66 64 671 673 60 679 681 687 689 693 699 60 715 717 56 56 50 717 721 721 46 38 721 729 735 737 737 741 32 741 747 755 759 763 32 765 24 777 22 22 781 781 14 795 801 809 813 14 815 821 825 12 825 6 0 837 845 0 -2 -24 845 847 851 -26 857 861 -28 871 -28 -34 871 -40 885 889 889 897 897 899 905 911 -40 -44 -46 -70 913 913 919 -72 -74 923 -80 -82 925 -82 927 931 937 937 943 -84 945 945 -84 949 951 955 955 955 965 975 981 -86 983 -88 991 993 999 -88 -90 -104 -104 -110 -112 -132 -138 -138 -138 -146 -154 -156 -160 -178 -180 -182 -196 -202 -206 -210 -218 -220 -224 -224 -224 -224 -224 -234 -242 -246 -248 -252 -254 -256 -256 -266 -266 -270 -274 -276 -280 -282 -284 -284 -286 -288 -290 -290 -294 -294 -294 -300 -308 -308 -344 -346 -350 -350 -352 -352 -358 -362 -364 -364 -366 -368 -374 -376 -380 -382 -386 -394 -402 -406 -412 -416 -418 -418 -418 -420 -428 -438 -438 -438 -440 -444 -448 -450 -462 -462 -466 -468 -468 -472 -476 -478 -488 -504 -504 -504 -504 -506 -506 -512 -514 -514 -518 -522 -522 -528 -540 -544 -546 -550 -554 -554 -568 -572 -572 -574 -576 -580 -580 -582 -594 -598 -602 -602 -608 -610 -616 -616 -616 -618 -628 -628 -628 -630 -632 -634 -634 -636 -638 -640 -658 -660 -664 -668 -672 -672 -676 -678 -682 -682 -684 -684 -688 -690 -690 -692 -696 -700 -700 -702 -704 -716 -720 -724 -726 -728 -728 -728 -728 -730 -738 -740 -744 -746 -752 -754 -766 -768 -778 -780 -788 -790 -800 -802 -804 -804 -810 -810 -812 -814 -814 -818 -822 -828 -832 -836 -840 -842 -844 -850 -858 -858 -872 -876 -890 -892 -896 -902 -902 -906 -908 -910 -910 -910 -910 -920 -920 -922 -922 -922 -922 -924 -934 -938 -950 -954 -956 -958 -968 -978 -986 -990 -992 -992 -994 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":"2013-09-26T04:17:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-26T04:12:00.000Z","updated_at":"2026-01-22T14:04:54.000Z","published_at":"2013-09-26T04:14:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2014 China Sorting\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Subset of cases.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Vout a sorted vector Odds Increasing/Evens Increasing\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eV= [-5 -12 87 2 88 20 11]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eVout=[-5 88 11 20 2 -12 87]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eContest Performance:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Time to Complete: \u0026lt; 10 minutes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46573,"title":"Determine the winner of a goofy golf tournament","description":"My brother and father were playing golf one day, and they caught up to a group that was part of a tournament. The group members explained that the tournament's rules were unconventional:\r\nThe golfer with the best score must have cheated, so that person is eliminated.\r\nThe golfer with the second-best score must have choked (definition, example), so that person is eliminated.\r\nTherefore, the golfer with the third-best score wins.\r\nWrite a function that takes a vector of scores and determines the winner of this tournament (i.e., the number of the golfer with the third-best score). Remember that the objective in golf is to get a low score. You can assume that if two golfers tie for the best score, a playoff would separate them, and the player with the original second lowest score would win. If two golfers tie for the second-best score, eliminate them both. Let's ignore the possibility of a tie for third-best score; the organizers of the tournament probably had everyone figure it out at the 19th hole. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 239.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 119.75px; transform-origin: 407px 119.75px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 375.217px 8px; transform-origin: 375.217px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eMy brother and father were playing golf one day, and they caught up to a group that was part of a tournament. The group members explained that the tournament's rules were unconventional:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 62.5px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 31.25px; transform-origin: 391px 31.25px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.8333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4167px; text-align: left; transform-origin: 363px 10.4167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 243.875px 8px; transform-origin: 243.875px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe golfer with the best score must have cheated, so that person is eliminated.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.8333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4167px; text-align: left; transform-origin: 363px 10.4167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 179.7px 8px; transform-origin: 179.7px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe golfer with the second-best score must have choked (\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Choke_(sports)\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003edefinition\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 3.88333px 8px; transform-origin: 3.88333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=A24tAToTxLU\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eexample\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 93.35px 8px; transform-origin: 93.35px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e), so that person is eliminated.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.8333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4167px; text-align: left; transform-origin: 363px 10.4167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 157.525px 8px; transform-origin: 157.525px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTherefore, the golfer with the third-best score wins.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.025px 8px; transform-origin: 374.025px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector of scores and determines the winner of this tournament (i.e., the number of the golfer with the third-best score). Remember that the objective in golf is to get a \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 10.5083px 8px; transform-origin: 10.5083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003elow\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 140.533px 8px; transform-origin: 140.533px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e score. You can assume that if two golfers tie for the best score, a playoff would separate them, and the player with the original second lowest score would win. If two golfers tie for the second-best score, eliminate them both. Let's ignore the possibility of a tie for third-best score; the organizers of the tournament probably had everyone figure it out at the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Nineteenth_hole\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e19th hole\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 8px; transform-origin: 3.88333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function winner = goofyTournament(x)\r\n  winner = min(x);  % Variable winner = number of the golfer with third-best score\r\nend","test_suite":"%%\r\nx = [81 78 68 71 74 86 77 76];\r\nwinner_correct = 5;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = [72 74 75 65 67 70 71 80 78 79 80 71];\r\nwinner_correct = 6;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = [85 83 81 79 77 67 66 72 73 74 71 82];\r\nwinner_correct = 11;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = [71 68 70 78 75 73 70 70 72 72 75 72];\r\nwinner_correct = 1;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = 67+randperm(20);\r\nwinner_correct = find(x==70);\r\nassert(isequal(goofyTournament(x),winner_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":46909,"edited_at":"2023-09-09T15:55:11.000Z","deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-06T18:02:51.000Z","updated_at":"2026-01-21T13:56:55.000Z","published_at":"2020-09-06T18:46:03.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMy brother and father were playing golf one day, and they caught up to a group that was part of a tournament. The group members explained that the tournament's rules were unconventional:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe golfer with the best score must have cheated, so that person is eliminated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe golfer with the second-best score must have choked (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Choke_(sports)\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edefinition\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=A24tAToTxLU\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eexample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e), so that person is eliminated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTherefore, the golfer with the third-best score wins.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector of scores and determines the winner of this tournament (i.e., the number of the golfer with the third-best score). Remember that the objective in golf is to get a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003elow\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e score. You can assume that if two golfers tie for the best score, a playoff would separate them, and the player with the original second lowest score would win. If two golfers tie for the second-best score, eliminate them both. Let's ignore the possibility of a tie for third-best score; the organizers of the tournament probably had everyone figure it out at the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Nineteenth_hole\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e19th hole\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44443,"title":"Matrix to vector transformation","description":"given a matrix, make in the output 1 column vector putting odd numbers in ascending order after that put the even numbers in descending order.\r\n*Note* :no repeated numbers in the output. Example\r\n  \r\n\r\n  x=   1     2     3\r\n       4     5     6\r\n       7     8     9\r\n\r\n  y=   1\r\n       3\r\n       5\r\n       7\r\n       9\r\n       8\r\n       6\r\n       4\r\n       2","description_html":"\u003cp\u003egiven a matrix, make in the output 1 column vector putting odd numbers in ascending order after that put the even numbers in descending order. \u003cb\u003eNote\u003c/b\u003e :no repeated numbers in the output. Example\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex=   1     2     3\r\n     4     5     6\r\n     7     8     9\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ey=   1\r\n     3\r\n     5\r\n     7\r\n     9\r\n     8\r\n     6\r\n     4\r\n     2\r\n\u003c/pre\u003e","function_template":"function y = vectorizeit(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3;4 5 6;7 8 9];\r\ny_correct = [1 3 5 7 9 8 6 4 2]'\r\nassert(isequal(vectorizeit(x),y_correct))\r\n%%\r\nx = [5 8 9 ;7 22 9];\r\ny_correct = [5 7 9 22 8]'\r\nassert(isequal(vectorizeit(x),y_correct))\r\n%%\r\nx = [88 99; 0  64];\r\ny_correct = [99 88 64 0]'\r\nassert(isequal(vectorizeit(x),y_correct))\r\n%%\r\nx = [0 0; 1  1];\r\ny_correct = [1 0]'\r\nassert(isequal(vectorizeit(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":49,"test_suite_updated_at":"2017-12-08T14:05:18.000Z","rescore_all_solutions":false,"group_id":675,"created_at":"2017-12-08T13:29:49.000Z","updated_at":"2026-02-18T16:47:59.000Z","published_at":"2017-12-08T13:29:49.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven a matrix, make in the output 1 column vector putting odd numbers in ascending order after that put the even numbers in descending order.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNote\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e :no repeated numbers in the output. Example\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x=   1     2     3\\n     4     5     6\\n     7     8     9\\n\\ny=   1\\n     3\\n     5\\n     7\\n     9\\n     8\\n     6\\n     4\\n     2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43072,"title":"Check if a rotated array was originally sorted","description":"Suppose a sorted array is rotated at some pivot unknown to you. For example, |[0 1 2 4 5 6 7]|  might become |[5 6 7 0 1 2 4]|.\r\n\r\nGiven a rotated array, find out if it was originally sorted. Your function will return *true* for this array: |[4 5 6 7 0 1 2]|. But it will return *false* for |[2 5 6 8 0 1 3]|, because its original array, i.e.,  |[0 1 3 2 5 6 8]|, was not sorted.","description_html":"\u003cp\u003eSuppose a sorted array is rotated at some pivot unknown to you. For example, \u003ctt\u003e[0 1 2 4 5 6 7]\u003c/tt\u003e  might become \u003ctt\u003e[5 6 7 0 1 2 4]\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eGiven a rotated array, find out if it was originally sorted. Your function will return \u003cb\u003etrue\u003c/b\u003e for this array: \u003ctt\u003e[4 5 6 7 0 1 2]\u003c/tt\u003e. But it will return \u003cb\u003efalse\u003c/b\u003e for \u003ctt\u003e[2 5 6 8 0 1 3]\u003c/tt\u003e, because its original array, i.e.,  \u003ctt\u003e[0 1 3 2 5 6 8]\u003c/tt\u003e, was not sorted.\u003c/p\u003e","function_template":"function y = isRotaSorTED(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = [4 5 6 7 0 1 2];\r\ny_correct = true;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = [2 5 6 8 0 1 3];\r\ny_correct = false;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = [101, 103, 106, 109, 158, 164, 182, 187, 202, 205, 2, 3, 32, 57, 69, 74, 81, 99, 100];\r\ny_correct = true;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = [42 1:10];\r\ny_correct = true;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = 1:10;\r\nx(1) = 100; x(4) = 1;\r\ny_correct = false;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = 10:-1:1;\r\ny_correct = false;\r\nassert(isequal(isRotaSorTED(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":25354,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":80,"test_suite_updated_at":"2018-05-23T13:13:55.000Z","rescore_all_solutions":false,"group_id":43,"created_at":"2016-10-05T19:43:37.000Z","updated_at":"2025-12-23T03:42:59.000Z","published_at":"2016-10-05T19:43:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSuppose a sorted array is rotated at some pivot unknown to you. For example,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[0 1 2 4 5 6 7]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e might become\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[5 6 7 0 1 2 4]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a rotated array, find out if it was originally sorted. Your function will return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etrue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e for this array:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[4 5 6 7 0 1 2]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. But it will return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efalse\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[2 5 6 8 0 1 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, because its original array, i.e., \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[0 1 3 2 5 6 8]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, was not sorted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44541,"title":"Arrange the names in alphabetical order (2)","description":"Arrange the list of names in alphabetical order, following the German standard \u003chttps://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutschland *DIN 5007*, Variant 2, §6.1.1.4.2 — _for lists of people's names_\u003e.  \r\n\r\nSpecial characters:   \r\nä = ae,   \r\nö = oe,   \r\nü = ue,   \r\nß = ss.  \r\n\r\nThe above special characters *must* be heeded in determining the correct sequence, and retained unaltered in the final output.  Other accents would typically be ignored, but are in any case not present in the Test Suite.  Hyphens and spaces do not affect the sequence.  \r\n\r\nPrefixes:   \r\nIgnore \u003chttps://de.wikipedia.org/wiki/Namenszusatz#Ursprüngliche_Herkunftsbezeichnungen prefixes\u003e such as \"von\", \"von der\", \"vor\", \"am\", \"zum\". These can, in general, be identified in that they are *not* capitalised — _see example below_.  Capitalisation (uppercase versus lowercase) must be preserved in your final output.  \r\n\r\nSorting should be based on the _surname_ [~family name].  The surname (together with any prefixes!) will always appear _first_, followed by a comma and then the given name(s) [first name(s)].  \r\nIn principle, if two surnames were alike, then one would have to next sort by the given name(s) — however, that situation does *not* arise, and will not arise, in the Test Suite.  \r\n\r\nInputs comprise cell arrays of character vectors.  The cell arrays can be either row or column vectors.  Return your output in the same type of vector.  \r\n\r\nEXAMPLE:\r\n\r\n % Input\r\n in = {'Hofmann, Michael' \r\n       'Hölderlin, Friedrich' \r\n       'Holz, Arno'\r\n       'van Hoddis, Jakob' \r\n       'von Hofmannsthal, Hugo'}\r\n % Output\r\n out = {'van Hoddis, Jakob' \r\n       'Hölderlin, Friedrich' \r\n       'Hofmann, Michael' \r\n       'von Hofmannsthal, Hugo' \r\n       'Holz, Arno'}\r\n\r\nSee also:\r\n\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44538 Problem 44538\u003e","description_html":"\u003cp\u003eArrange the list of names in alphabetical order, following the German standard \u003ca href = \"https://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutschland\"\u003e\u003cb\u003eDIN 5007\u003c/b\u003e, Variant 2, §6.1.1.4.2 — \u003ci\u003efor lists of people's names\u003c/i\u003e\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eSpecial characters:   \r\nä = ae,   \r\nö = oe,   \r\nü = ue,   \r\nß = ss.\u003c/p\u003e\u003cp\u003eThe above special characters \u003cb\u003emust\u003c/b\u003e be heeded in determining the correct sequence, and retained unaltered in the final output.  Other accents would typically be ignored, but are in any case not present in the Test Suite.  Hyphens and spaces do not affect the sequence.\u003c/p\u003e\u003cp\u003ePrefixes:   \r\nIgnore \u003ca href = \"https://de.wikipedia.org/wiki/Namenszusatz#Ursprüngliche_Herkunftsbezeichnungen\"\u003eprefixes\u003c/a\u003e such as \"von\", \"von der\", \"vor\", \"am\", \"zum\". These can, in general, be identified in that they are \u003cb\u003enot\u003c/b\u003e capitalised — \u003ci\u003esee example below\u003c/i\u003e.  Capitalisation (uppercase versus lowercase) must be preserved in your final output.\u003c/p\u003e\u003cp\u003eSorting should be based on the \u003ci\u003esurname\u003c/i\u003e [~family name].  The surname (together with any prefixes!) will always appear \u003ci\u003efirst\u003c/i\u003e, followed by a comma and then the given name(s) [first name(s)].  \r\nIn principle, if two surnames were alike, then one would have to next sort by the given name(s) — however, that situation does \u003cb\u003enot\u003c/b\u003e arise, and will not arise, in the Test Suite.\u003c/p\u003e\u003cp\u003eInputs comprise cell arrays of character vectors.  The cell arrays can be either row or column vectors.  Return your output in the same type of vector.\u003c/p\u003e\u003cp\u003eEXAMPLE:\u003c/p\u003e\u003cpre\u003e % Input\r\n in = {'Hofmann, Michael' \r\n       'Hölderlin, Friedrich' \r\n       'Holz, Arno'\r\n       'van Hoddis, Jakob' \r\n       'von Hofmannsthal, Hugo'}\r\n % Output\r\n out = {'van Hoddis, Jakob' \r\n       'Hölderlin, Friedrich' \r\n       'Hofmann, Michael' \r\n       'von Hofmannsthal, Hugo' \r\n       'Holz, Arno'}\u003c/pre\u003e\u003cp\u003eSee also:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44538\"\u003eProblem 44538\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e","function_template":"% Comments ...\r\nfunction y = meSortEm( xVector )\r\n    z = x;\r\nend","test_suite":"%% Ensure generality\r\n% Don't hardcode solutions or use test-specific lookup tables of surnames.\r\n% (Lookup tables of letters and/or prefixes are allowed, if you want, though.)\r\nRE = regexp(fileread('meSortEm.m'), '\\w+', 'match');\r\ntabooWords = {'Hölderlin' 'Friedrich' 'Holz' 'Arno' ...\r\n                'Hoffmann' 'Josef' 'Hübsch' 'Heinrich' ...\r\n                'Grass' 'Günter' 'Grünberg' 'Arnon' 'Strauch' 'Hugo' 'Strauß' 'Botho' ...\r\n                'Deutsch' 'Gerti' 'Dietrich' 'Adolf' 'Dücker' 'Eugen'};\r\ntestResult = cellfun( @(z) ismember(z, lower(tabooWords)), lower(RE) );\r\nmsg = ['Please do not hard-code your ''solution''.' char([10 13]) 'Found: ' strjoin(RE(testResult)) '.' char([10 13])];\r\nassert( ~any( testResult ), msg )\r\n\r\n\r\n%% A few authors, as in the example from the Problem Statement\r\nlist = {'van Hoddis, Jakob' \r\n       'Hölderlin, Friedrich' \r\n       'Hofmann, Michael' \r\n       'von Hofmannsthal, Hugo' \r\n       'Holz, Arno'};\r\ninput = {'Hofmann, Michael' \r\n       'Hölderlin, Friedrich' \r\n       'Holz, Arno'\r\n       'van Hoddis, Jakob' \r\n       'von Hofmannsthal, Hugo'};\r\nassert( isequal(meSortEm(input), list) )\r\n\r\n\r\n%% Architects\r\ndata = {'Auböck, Maria' 'Behnisch, Günther' 'Böhm, Elisabeth' 'van den Broek, Jo' 'van Campen, Jacob' 'Dudok, Willem Marinus' 'von Erdmannsdorff, Frederick William' 'van Eyck, Aldo' ...\r\n    'Gaddi, Taddeo' 'von Gärtner, Friedrich' 'Galilei, Alessandro' 'Gang, Jeanne' 'Gardella, Ignazio' 'Garnier, Charles' 'Gatermann, Dörte' 'Gauzin-Müller, Dominique' ...\r\n    'von Gontard, Carl' 'Höger, Fritz' 'Hoffmann, Josef' 'Hübsch, Heinrich' 'Hundertwasser, Friedensreich Regentag Dunkelbunt' 'de Key, Lieven' 'de Keyser, Hendrick' 'von Klenze, Leo' ...\r\n    'von Knobelsdorff, Georg Wenzeslaus' 'Mies, Maria Ludwig Michael' 'Mies van der Rohe, Ludwig' 'Pöppelmann, Matthäus Daniel' 'van Ravesteyn, Sybold' 'de Ridder van Groenesteyn, Stefan' 'von Ritter zu Groenesteyn, Caspar Wilhelm' 'von Ritter von Grünstein, Anselm Franz' ...\r\n    'Schneider-Esleben, Paul' 'Schütte-Lihotzky, Margarete' 'Staal-Kropholler, Margaret' 'Stowasser, Friedrich' 'van der Vlugt, Leendert' 'Wils, Jan' 'van Winden, Wilfried' 'van Zuuk, René'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 20+randi(L-20));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Authors\r\ndata = {'von Arnim, Bettina' 'Böll, Heinrich' 'Büchner, Georg' 'Busch, Wilhelm' 'von Doderer, Heimito' 'von Droste-Hülshoff, Annette' 'von Ebner-Eschenbach, Marie' 'von Eichendorff, Joseph' 'von Eschenbach, Wolfram' 'Fleißer, Marieluise' ...\r\n    'Gauß, Karl-Markus' 'Görres, Joseph' 'von Goethe, Johann Wolfgang' 'Grass, Günter' 'Grünberg, Arnon' 'Haasse, Hella' 'Härtling, Peter' 'Hamerling, Robert' 'Handke, Peter' 'von Hardenberg, Georg Philipp Friedrich' ...\r\n    'de Hartog, Jan' 'Heißenbüttel, Helmut' 'Hochhuth, Rolf' 'Hölderlin, Friedrich' 'Hoffmann, E.T.A.' 'von Hofmannsthal, Hugo' 'Jünger, Ernst' 'Kästner, Erich' 'Kaminer, Wladimir' 'Kehlmann, Daniel' ...\r\n    'von Kleist, Heinrich' 'Kofler, Werner' 'Laßwitz, Kurd' 'von Leitner, Karl Gottfried' 'Lenz, Siegfried' 'Lernet-Holenia, Alexander' 'van Loon, Hendrik Willem' 'Nöstlinger, Christine' 'Preußler, Otfried' 'von Pückler-Muskau, Hermann Ludwig Heinrich' ...\r\n    'Raabe, Wilhelm' 'Raimund, Ferdinand' 'Rühmkorf, Peter' 'Strätz, Harald' 'Strahl, Manfred' 'Stramm, August' 'von Straßburg, Gottfried' 'Strasser, Charlot' 'Stratz, Rudolph' 'Straub, Maria Elisabeth' ...\r\n    'Strauch, Hugo' 'Strauß, Botho' 'von Strauß und Torney, Luise Elisabeth' 'Suchenwirt, Peter' 'Sudermann, Hermann' 'Sülzer, Bernd' 'Süskind, Patrick' 'Süßmann, Christel' 'Süverkrüp, Dieter' 'Sula, Marianne' ...\r\n    'Sulzenbacher, Hannes' 'Sulzer, Alain Claude' 'von Suttner, Bertha' 'von Trimberg, Süßkind' 'von der Vogelweide, Walter' 'van den Vondel, Joost' 'Voß, Johann Heinrich' 'de Vries, Anne' 'von Waldenfels, Rudolf' 'Walser, Martin' ...\r\n    'von Weißenburg, Otfrid' 'van de Wetering, Janwillem' 'von Wilpert, Gero' 'von Wolkenstein, Oswald' 'von Zatzikhoven, Ulrich'};\r\ndata = data';\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 35+randi(L-35));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Artists, esp. painters (~A \u0026 D)\r\n% Amended 2018-03-11 to remove duplicate surname.  \r\ndata = {'Albers, Josef' 'Aldenrath, Heinrich Jacob' 'Alexander, William' 'Allers, Christian Wilhelm' 'Daege, Eduard' 'Dähling, Heinrich Anton' 'Dahm, Helen' 'Danckerts, Hendrick' ...\r\n    'Danioth, Heinrich' 'Dauerer, Gabriela' 'Decker, Cornelis Gerritsz' 'Degen, Paul' 'van Delen, Dirck' 'Deutsch, Gerti' 'van Diepenbeeck, Abraham' 'Diepraam, Abraham' ...\r\n    'Dietrich, Adolf' 'Dietz, Feodor' 'von Diez, Wilhelm' 'van Dijck, Floris Claesz' 'Dill, Ludwig' 'von Dillis, Johann Georg' 'Dinger, Fritz' 'Dinglinger, Georg Friedrich' ...\r\n    'Disler, Martin' 'Disteli, Martin' 'Dix, Otto' 'Doepler, Emil' 'Dörbeck, Franz Burchard' 'Doerner, Max' 'Domscheit, Franz' 'Donck, Gerard' ...\r\n    'Doomer, Lambert' 'Dou, Gerard' 'Drache, Heinz' 'Dräger, Anton Josef' 'Dreber, Heinrich' 'Dreesen, Willi' 'Droochsloot, Cornelis' ...\r\n    'Drost, Willem' 'Dryander, Johann Friedrich' 'Dubbels, Hendrick Jacobsz' 'Dubordieu, Pieter' 'Duck, Jacob' 'Dücker, Eugen' 'Dürer, Albrecht' 'Dufaux, Henri' ...\r\n    'Dujardin, Karel' 'Dunker, Balthasar Anton' 'Dusart, Cornelis' 'Duyster, Willem Cornelisz' 'Dyck, Hermann' 'Dziersk, Udo'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 25+randi(L-25));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Hyphenated names\r\n% Added 2018-03-11 to test handling of hyphenation.  \r\ndata = {'Droste, Udo' 'Droste-Doderer, Heimito' 'von Droste-Hülshoff, Gerti' 'Droste-Strauß, Annette' 'Ebner, Wolfram' 'Ebner-Eichendorff, Willem' 'von Ebner-Eschenbach, Marie' 'Ebner-Nöstlinger, Christine' 'von Gauzin, Carl' 'Gauzin-Gatermann, Dominique' ...\r\n    'van Gauzin-Gontard, Dörte' 'Gauzin-Müller, Anton' 'Lernet, Hermann' 'Lernet-Holenia, Willem' 'Lernet-Loon, Hendrik' 'van Lernet-Süßmann, Christel' 'Pückler, Ludwig' 'Pückler-Dauerer, Gabriela' 'von Pückler-Muskau, Otfried' 'Pückler-Preußler, Heinrich'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 10+randi(L-10));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":"2018-03-11T05:39:54.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-03-10T03:11:08.000Z","updated_at":"2018-03-11T05:39:54.000Z","published_at":"2018-03-10T05:27:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eArrange the list of names in alphabetical order, following the German standard\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutschland\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDIN 5007\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, Variant 2, §6.1.1.4.2 —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efor lists of people's names\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSpecial characters:    ä = ae,    ö = oe,    ü = ue,    ß = ss.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe above special characters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e be heeded in determining the correct sequence, and retained unaltered in the final output. Other accents would typically be ignored, but are in any case not present in the Test Suite. Hyphens and spaces do not affect the sequence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrefixes:    Ignore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://de.wikipedia.org/wiki/Namenszusatz#Ursprüngliche_Herkunftsbezeichnungen\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eprefixes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e such as \\\"von\\\", \\\"von der\\\", \\\"vor\\\", \\\"am\\\", \\\"zum\\\". These can, in general, be identified in that they are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e capitalised —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esee example below\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Capitalisation (uppercase versus lowercase) must be preserved in your final output.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSorting should be based on the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esurname\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [~family name]. The surname (together with any prefixes!) will always appear\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efirst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, followed by a comma and then the given name(s) [first name(s)]. In principle, if two surnames were alike, then one would have to next sort by the given name(s) — however, that situation does\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e arise, and will not arise, in the Test Suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % Input\\n in = {'Hofmann, Michael' \\n       'Hölderlin, Friedrich' \\n       'Holz, Arno'\\n       'van Hoddis, Jakob' \\n       'von Hofmannsthal, Hugo'}\\n % Output\\n out = {'van Hoddis, Jakob' \\n       'Hölderlin, Friedrich' \\n       'Hofmann, Michael' \\n       'von Hofmannsthal, Hugo' \\n       'Holz, Arno'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44538\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44538\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1893,"title":"GJam 2014 China Rd A: Library Sorting (Small)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2924486/dashboard#s=p2 GJam 2014 China Sorting\u003e. \r\n\r\nThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations. \r\n\r\n*Input:* V   a vector\r\n\r\n*Output:* Vout  a sorted vector Odds Increasing/Evens Increasing\r\n\r\n*Example:*\r\n\r\nV= [-5 -12 87 2 88 20 11]\r\n\r\nVout=[-5 88 11 20 2 -12 87]\r\n\r\n\r\n*Contest Performance:*  Best Time to Complete: \u003c 10 minutes\r\n","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\"\u003eGJam 2014 China Sorting\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V   a vector\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Vout  a sorted vector Odds Increasing/Evens Increasing\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eV= [-5 -12 87 2 88 20 11]\u003c/p\u003e\u003cp\u003eVout=[-5 88 11 20 2 -12 87]\u003c/p\u003e\u003cp\u003e\u003cb\u003eContest Performance:\u003c/b\u003e  Best Time to Complete: \u0026lt; 10 minutes\u003c/p\u003e","function_template":"function vout=Sort_CH(v)\r\n vout=v;\r\nend","test_suite":"%%\r\ntic\r\nv=[1 ];\r\nvexp=[1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[2 1 ];\r\nvexp=[2 1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 ];\r\nvexp=[1 2 3 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 4 5 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[5 2 3 4 1 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 -87 -85 -83 -71 -71 98 96 -67 -63 -59 -53 -47 -41 96 -41 82 -37 -29 82 -25 -25 80 -21 -13 -11 5 76 72 72 66 66 66 9 60 15 31 35 56 52 52 46 42 39 45 42 40 36 45 30 24 18 51 18 12 53 0 63 -6 65 -10 -12 67 69 79 85 85 -14 89 -16 -22 89 -24 91 -24 -26 -30 -38 -38 -38 -42 -44 -58 -58 -60 -62 -66 -68 -70 -70 -82 -82 -86 -86 -86 -94 -100 ];\r\nvexp=[-87 -87 -85 -83 -71 -71 98 96 -67 -63 -59 -53 -47 -41 96 -41 82 -37 -29 82 -25 -25 80 -21 -13 -11 5 76 72 72 66 66 66 9 60 15 31 35 56 52 52 46 42 39 45 42 40 36 45 30 24 18 51 18 12 53 0 63 -6 65 -10 -12 67 69 79 85 85 -14 89 -16 -22 89 -24 91 -24 -26 -30 -38 -38 -38 -42 -44 -58 -58 -60 -62 -66 -68 -70 -70 -82 -82 -86 -86 -86 -94 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-95 98 -81 -55 90 -29 -19 35 37 75 79 85 93 97 56 54 14 14 0 -14 -22 -34 -38 -46 -62 -90 -98 ];\r\nvexp=[-95 98 -81 -55 90 -29 -19 35 37 75 79 85 93 97 56 54 14 14 0 -14 -22 -34 -38 -46 -62 -90 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-89 -75 -73 -65 86 86 68 66 -41 -37 -25 56 5 21 25 52 36 26 14 27 29 35 45 6 51 63 87 93 -22 95 -26 -48 -54 -70 95 -86 -92 -96 ];\r\nvexp=[-89 -75 -73 -65 86 86 68 66 -41 -37 -25 56 5 21 25 52 36 26 14 27 29 35 45 6 51 63 87 93 -22 95 -26 -48 -54 -70 95 -86 -92 -96 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[76 -7 ];\r\nvexp=[76 -7 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-93 96 -91 86 -87 -87 -67 -53 68 30 -33 0 -33 -13 1 0 3 -10 3 -10 -16 19 23 45 51 -18 53 -30 -36 -72 79 -82 -96 83 91 ];\r\nvexp=[-93 96 -91 86 -87 -87 -67 -53 68 30 -33 0 -33 -13 1 0 3 -10 3 -10 -16 19 23 45 51 -18 53 -30 -36 -72 79 -82 -96 83 91 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 100 96 -81 86 -79 -79 -77 -73 -69 -69 -65 82 -59 -59 70 70 -57 -49 -47 70 -43 -41 54 -35 -31 -31 -29 -25 -17 -13 -5 50 -5 -3 7 21 25 46 27 27 44 31 33 35 37 44 49 42 38 49 51 34 69 34 75 83 20 85 87 91 91 14 12 10 6 0 0 0 -8 -8 -20 -24 -26 -34 -36 -40 -52 -56 -60 -66 -68 -68 -72 -72 -80 -84 -84 -90 -90 ];\r\nvexp=[-87 100 96 -81 86 -79 -79 -77 -73 -69 -69 -65 82 -59 -59 70 70 -57 -49 -47 70 -43 -41 54 -35 -31 -31 -29 -25 -17 -13 -5 50 -5 -3 7 21 25 46 27 27 44 31 33 35 37 44 49 42 38 49 51 34 69 34 75 83 20 85 87 91 91 14 12 10 6 0 0 0 -8 -8 -20 -24 -26 -34 -36 -40 -52 -56 -60 -66 -68 -68 -72 -72 -80 -84 -84 -90 -90 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 100 -81 -75 96 86 -71 -71 86 -33 -27 -25 82 -21 76 -11 68 5 7 9 13 68 15 25 41 41 51 61 56 61 56 67 54 67 48 83 89 91 99 34 30 28 16 16 10 10 4 0 0 0 0 -24 -26 -26 -34 -48 -50 -62 -66 -92 -100 ];\r\nvexp=[-87 100 -81 -75 96 86 -71 -71 86 -33 -27 -25 82 -21 76 -11 68 5 7 9 13 68 15 25 41 41 51 61 56 61 56 67 54 67 48 83 89 91 99 34 30 28 16 16 10 10 4 0 0 0 0 -24 -26 -26 -34 -48 -50 -62 -66 -92 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-93 -89 -87 88 -85 -75 -65 -63 -61 -59 -49 84 -39 -37 80 80 -37 -25 -11 -7 78 -5 78 72 3 5 9 58 11 50 46 23 29 29 31 35 44 37 49 67 71 44 40 30 71 30 28 24 75 75 79 83 18 97 99 6 6 2 0 -4 -8 -10 -16 -18 -30 -32 -34 -36 -38 -46 -46 -48 -48 -52 -54 -56 -66 -68 -88 -90 -100 -100 -100 ];\r\nvexp=[-93 -89 -87 88 -85 -75 -65 -63 -61 -59 -49 84 -39 -37 80 80 -37 -25 -11 -7 78 -5 78 72 3 5 9 58 11 50 46 23 29 29 31 35 44 37 49 67 71 44 40 30 71 30 28 24 75 75 79 83 18 97 99 6 6 2 0 -4 -8 -10 -16 -18 -30 -32 -34 -36 -38 -46 -46 -48 -48 -52 -54 -56 -66 -68 -88 -90 -100 -100 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[90 -89 90 74 -87 62 -83 -79 58 -77 -75 -75 -63 52 52 -59 46 42 -49 -39 -31 36 12 -25 6 -13 -11 5 9 17 23 29 39 -2 -8 -10 47 63 -28 -54 -70 -74 -78 63 65 83 -82 -84 91 97 97 ];\r\nvexp=[90 -89 90 74 -87 62 -83 -79 58 -77 -75 -75 -63 52 52 -59 46 42 -49 -39 -31 36 12 -25 6 -13 -11 5 9 17 23 29 39 -2 -8 -10 47 63 -28 -54 -70 -74 -78 63 65 83 -82 -84 91 97 97 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-97 88 -93 74 70 46 38 36 -91 -85 -83 -77 -67 -63 -55 34 -45 32 -37 16 0 0 -23 -21 -2 -4 5 13 27 -10 -32 -38 -38 -50 39 -56 45 49 -56 77 -56 87 95 97 -62 -62 -68 -68 -72 -80 -94 ];\r\nvexp=[-97 88 -93 74 70 46 38 36 -91 -85 -83 -77 -67 -63 -55 34 -45 32 -37 16 0 0 -23 -21 -2 -4 5 13 27 -10 -32 -38 -38 -50 39 -56 45 49 -56 77 -56 87 95 97 -62 -62 -68 -68 -72 -80 -94 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[81 29 29 -71 -70 16 -70 -93 25 97 51 3 -8 39 -83 97 98 -86 -53 69 58 86 19 75 9 87 -84 66 75 82 85 -87 53 7 65 99 -93 59 -74 4 1 -15 -22 59 -35 -15 51 -10 -27 -98 60 -17 37 29 -98 69 83 9 51 13 -12 -13 50 -39 45 5 -34 75 -84 15 -91 18 -97 -8 0 -44 34 79 -13 -74 -92 80 -84 -92 -32 -46 -26 46 -16 -32 -72 16 84 -46 22 -32 84 58 28 -60 ];\r\nvexp=[-97 -93 -93 -91 98 86 84 -87 -83 -71 -53 -39 84 -35 -27 -17 82 80 -15 -15 66 60 -13 -13 1 3 58 58 5 50 7 9 9 13 15 19 25 29 46 34 29 29 28 37 39 45 51 22 51 18 16 51 53 59 16 59 65 69 69 75 4 75 0 75 79 81 -8 83 -8 85 87 -10 97 -12 -16 -22 -26 97 99 -32 -32 -32 -34 -44 -46 -46 -60 -70 -70 -72 -74 -74 -84 -84 -84 -86 -92 -92 -98 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[10 50 52 3 -29 51 29 -89 55 -34 -77 -41 65 7 -89 0 -44 -98 61 -21 11 -57 -10 95 -12 -25 91 28 90 -49 -57 97 57 -47 33 -59 7 -39 55 91 -89 -41 -7 -18 -61 -93 78 -57 97 45 44 -59 5 38 9 28 -38 11 -36 -92 15 -70 44 -84 18 -24 38 20 -54 0 2 44 28 12 42 -22 74 6 -72 -52 34 -50 30 -44 -6 -42 98 -96 42 38 64 92 -36 92 -90 2 -6 -44 -98 -2 ];\r\nvexp=[98 92 92 -93 -89 -89 -89 -77 -61 90 -59 -59 -57 -57 -57 78 74 64 -49 -47 -41 -41 52 -39 50 -29 -25 44 44 -21 -7 3 5 7 7 9 11 11 15 29 33 45 51 44 55 55 42 57 61 65 42 91 91 38 95 38 38 97 34 30 97 28 28 28 20 18 12 10 6 2 2 0 0 -2 -6 -6 -10 -12 -18 -22 -24 -34 -36 -36 -38 -42 -44 -44 -44 -50 -52 -54 -70 -72 -84 -90 -92 -96 -98 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[34 46 -93 78 -26 11 77 26 47 73 75 53 -89 -52 71 19 -52 -47 16 -19 74 49 21 1 -33 -89 5 -74 67 -55 88 -85 1 -41 93 53 -97 61 -71 -85 77 -45 -1 0 74 95 67 -65 -27 -2 -44 -8 -37 27 36 -58 71 -8 -95 43 17 -19 25 -5 -10 42 10 -64 27 94 41 -69 37 81 -97 -50 -54 66 -22 40 -62 90 -70 40 48 48 52 48 20 98 -42 92 88 40 36 -28 -10 -44 -52 96 ];\r\nvexp=[98 96 -97 94 92 -97 -95 90 -93 -89 -89 -85 -85 88 -71 -69 88 -65 78 -55 74 -47 -45 -41 -37 -33 -27 74 -19 -19 66 -5 -1 1 1 5 11 17 19 21 25 27 27 52 48 37 41 43 47 48 48 46 49 53 42 40 53 40 61 67 67 71 71 73 40 36 36 34 75 26 77 77 81 93 95 20 16 10 0 -2 -8 -8 -10 -10 -22 -26 -28 -42 -44 -44 -50 -52 -52 -52 -54 -58 -62 -64 -70 -74 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-27 ];\r\nvexp=[-27 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[53 75 55 -92 23 -19 83 -70 95 43 -57 1 -11 -9 42 -98 -30 -35 -35 94 -95 -43 -11 -44 96 53 23 -80 -77 -32 -34 45 -16 -2 -77 56 -92 0 -15 38 36 4 -18 72 -84 88 48 58 82 -4 88 -62 -10 -30 10 -100 22 0 -12 -40 -48 -74 ];\r\nvexp=[-95 -77 -77 96 -57 -43 -35 94 -35 -19 -15 -11 -11 -9 88 88 82 1 23 72 23 43 45 58 56 53 53 48 55 42 38 75 36 22 83 10 4 0 95 0 -2 -4 -10 -12 -16 -18 -30 -30 -32 -34 -40 -44 -48 -62 -70 -74 -80 -84 -92 -92 -98 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 63 -79 74 66 5 -51 -9 69 -58 -23 77 -75 -71 91 0 -40 41 -79 32 27 90 66 -56 100 -48 -80 14 -24 ];\r\nvexp=[-87 -79 -79 100 90 -75 -71 -51 -23 74 -9 5 27 41 63 66 66 69 77 32 91 14 0 -24 -40 -48 -56 -58 -80 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[91 34 34 -92 -34 42 99 51 0 54 17 -51 -31 -45 35 -33 92 7 -33 -45 0 -15 76 58 58 100 85 -68 5 -20 -13 83 -39 89 55 89 -90 84 -40 20 90 54 -84 -90 38 -100 60 64 54 32 -30 86 -60 90 -46 -58 -50 ];\r\nvexp=[-51 100 92 90 90 86 -45 -45 84 76 -39 -33 -33 -31 -15 -13 64 5 7 17 60 35 58 58 54 54 51 54 55 42 83 85 89 89 91 99 38 34 34 32 20 0 0 -20 -30 -34 -40 -46 -50 -58 -60 -68 -84 -90 -90 -92 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-41 25 30 -41 20 51 -75 -72 45 -73 75 -77 60 -79 -45 80 19 49 -25 -99 -16 71 55 -79 -35 31 -66 61 -19 -45 -55 -34 73 -55 17 -29 -41 65 -93 51 -58 62 99 73 59 -66 83 -95 -23 62 -82 -81 -31 -33 -9 -41 1 83 36 92 82 80 0 10 78 38 70 0 -52 4 -56 88 -92 -14 56 -6 -74 -90 92 96 86 96 -88 ];\r\nvexp=[-99 -95 96 -93 96 -81 -79 92 -79 -77 -75 -73 92 -55 -55 88 -45 -45 -41 -41 86 -41 -41 -35 -33 -31 82 -29 -25 -23 -19 80 -9 1 17 19 25 31 45 49 80 78 51 51 55 70 59 61 65 62 62 71 73 73 75 83 83 99 60 56 38 36 30 20 10 4 0 0 -6 -14 -16 -34 -52 -56 -58 -66 -66 -72 -74 -82 -88 -90 -92 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-55 93 -57 -68 25 48 -100 75 11 -82 -60 64 74 19 11 -87 -56 -10 45 74 -21 -5 1 12 55 66 -72 73 37 85 -97 -80 51 44 55 -54 -15 -79 32 -93 1 23 -77 -86 90 -71 82 4 14 -100 55 -51 33 -60 65 -30 -34 -37 -75 75 90 33 -35 38 -97 -72 49 4 24 42 88 -60 -78 -68 0 48 -44 -56 24 -12 -48 -78 100 68 -32 -58 24 -44 94 ];\r\nvexp=[-97 -97 -93 100 -87 94 90 -79 -77 90 88 82 74 -75 -71 -57 74 68 -55 66 -51 -37 -35 64 -21 48 48 -15 -5 1 1 44 11 42 11 38 19 23 32 25 33 33 37 24 24 45 24 14 12 4 49 51 55 4 55 0 -10 55 65 73 -12 75 75 -30 85 -32 93 -34 -44 -44 -48 -54 -56 -56 -58 -60 -60 -60 -68 -68 -72 -72 -78 -78 -80 -82 -86 -100 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-41 97 83 0 -33 87 29 18 21 30 90 4 -10 -56 -66 79 -25 55 -40 -55 1 1 0 85 -66 -15 36 -68 -100 65 -8 -77 64 -47 -60 -96 83 -67 12 -85 11 24 -63 -50 17 -60 ];\r\nvexp=[-85 -77 -67 90 -63 -55 -47 64 -41 36 30 24 18 12 4 -33 -25 -15 0 1 1 11 0 17 -8 21 -10 -40 -50 29 -56 55 -60 65 -60 -66 79 83 -66 83 85 -68 87 -96 97 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-75 77 13 57 62 43 -9 13 -61 -37 -19 49 -1 65 -53 -87 -40 -73 -33 80 -11 15 73 -42 -58 -20 85 -97 -57 22 -46 -60 8 62 30 -84 66 40 58 -44 -100 ];\r\nvexp=[-97 -87 -75 -73 80 -61 -57 -53 -37 -33 -19 -11 -9 -1 13 13 66 15 43 62 49 57 65 62 58 40 73 77 85 30 22 8 -20 -40 -42 -44 -46 -58 -60 -84 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[80 30 85 -54 -87 -32 47 33 57 -57 -64 50 67 -84 58 -79 37 -39 77 65 55 26 -58 47 -24 50 -34 72 65 30 38 -57 -49 13 -81 -3 -90 73 -69 91 -38 -49 -52 87 81 -70 51 -98 82 80 0 96 -68 -34 -54 -96 ];\r\nvexp=[96 82 -87 80 -81 80 -79 -69 -57 -57 72 58 -49 50 50 -49 -39 -3 13 33 37 38 30 47 30 26 0 -24 47 -32 -34 51 55 57 65 65 -34 67 73 77 -38 81 -52 85 87 -54 91 -54 -58 -64 -68 -70 -84 -90 -96 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[45 7 -49 57 7 -11 -7 53 -83 99 -90 9 87 100 16 -58 45 33 -98 30 -58 -50 -29 15 -66 76 -86 58 4 -82 ];\r\nvexp=[-83 -49 -29 -11 -7 7 7 9 15 33 100 45 45 76 58 30 53 57 16 4 -50 -58 87 99 -58 -66 -82 -86 -90 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-13 20 -29 34 47 -38 -55 -25 37 41 -87 47 31 -63 -27 -68 -35 32 77 11 -7 -91 -67 -32 59 41 -11 -81 10 96 -50 -11 74 0 -42 -22 92 -72 46 0 0 -80 78 -32 58 4 24 -22 -56 -34 60 ];\r\nvexp=[-91 96 -87 92 -81 78 -67 -63 -55 -35 -29 -27 -25 -13 -11 74 -11 60 -7 11 31 37 41 58 41 47 47 59 46 34 32 77 24 20 10 4 0 0 0 -22 -22 -32 -32 -34 -38 -42 -50 -56 -68 -72 -80 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[35 69 33 35 -7 -54 -89 95 -95 -72 2 42 -89 -10 17 -65 -99 -43 27 95 71 61 -5 -95 -82 21 47 79 -59 52 -44 -10 -19 53 35 -92 -35 -61 -95 -43 35 -98 95 -2 -19 66 89 -54 32 -18 36 72 -64 -10 -88 -50 -8 38 88 -50 ];\r\nvexp=[-99 -95 -95 -95 -89 88 -89 -65 -61 72 66 52 -59 42 -43 -43 -35 -19 -19 -7 -5 17 21 27 38 33 35 35 35 36 32 2 35 47 53 -2 61 69 71 79 89 -8 95 -10 95 -10 95 -10 -18 -44 -50 -50 -54 -54 -64 -72 -82 -88 -92 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-26T03:58:52.000Z","updated_at":"2026-03-11T15:29:23.000Z","published_at":"2013-09-26T04:09:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2014 China Sorting\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Vout a sorted vector Odds Increasing/Evens Increasing\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eV= [-5 -12 87 2 88 20 11]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eVout=[-5 88 11 20 2 -12 87]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eContest Performance:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Time to Complete: \u0026lt; 10 minutes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":247,"title":"Arrange Vector in descending order","description":"If x=[0,3,4,2,1] then y=[4,3,2,1,0]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 102px 8px; transform-origin: 102px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf x=[0,3,4,2,1] then y=[4,3,2,1,0]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = desSort(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [0,1,2,3,4];\r\ny_correct = [4,3,2,1,0];\r\nassert(isequal(desSort(x),y_correct))\r\n\r\n%%\r\nx = randperm(10);\r\ny_correct = 10:-1:1;\r\nassert(isequal(desSort(x),y_correct))\r\n\r\n%%\r\nx = [13 11 19 7 17];\r\ny_correct = [19 17 13 11 7];\r\nassert(isequal(desSort(x),y_correct))\r\n\r\n%%\r\nx = [5     4     2    12    10     3     7     7     1];\r\ny_correct = [12, 10, 7, 7, 5, 4, 3, 2, 1];\r\nassert(isequal(desSort(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":68,"comments_count":17,"created_by":868,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13390,"test_suite_updated_at":"2021-07-22T15:14:15.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-03T16:06:15.000Z","updated_at":"2026-04-06T00:32:23.000Z","published_at":"2012-02-03T16:08:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf x=[0,3,4,2,1] then y=[4,3,2,1,0]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":60426,"title":"Reversing Maximal Ascending Subsequences","description":"Create and return a new array that contains the same elements as the input array, but with the elements within each strictly increasing maximal subsequence reversed. \r\nExample:\r\nGiven the input array [5, 7, 10, 4, 2, 7, 8, 1, 3], the strictly increasing maximal subsequences are [5, 7, 10], [2, 7, 8], and [1, 3]. Reversing these subsequences gives [10, 7, 5], [8, 7, 2], and [3, 1], respectively. The output array is thus [10, 7, 5, 4, 8, 7, 2, 3, 1].","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 149.489px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 386.491px 74.7443px; transform-origin: 386.499px 74.7443px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42.017px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 363.494px 21.0085px; text-align: left; transform-origin: 363.501px 21.0085px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCreate and return a new array that contains the same elements as the input array, but with the elements within each strictly increasing maximal subsequence reversed. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21.0085px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 363.494px 10.4972px; text-align: left; transform-origin: 363.501px 10.5043px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 68.4801px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 363.494px 34.233px; text-align: left; transform-origin: 363.501px 34.2401px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven the input array \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[5, 7, 10, 4, 2, 7, 8, 1, 3]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, the strictly increasing maximal subsequences are \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[5, 7, 10]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[2, 7, 8]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[1, 3]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Reversing these subsequences gives \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[10, 7, 5]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[8, 7, 2]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[3, 1]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, respectively. The output array is thus \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[10, 7, 5, 4, 8, 7, 2, 3, 1]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = reverse_ascending(x)\r\n\r\nend","test_suite":"%%\r\nx = [5, 7, 10, 4, 2, 7, 8, 1, 3]\r\ny = reverse_ascending(x)\r\ny_correct = [10, 7, 5, 4, 8, 7, 2, 3, 1]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [a a b]\r\ny = reverse_ascending(x)\r\ny_correct = [a b a]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [a b a]\r\ny = reverse_ascending(x)\r\ny_correct = [b a a]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [b a a]\r\ny = reverse_ascending(x)\r\ny_correct = x\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [a b a b a]\r\ny = reverse_ascending(x)\r\ny_correct = [b a b a a]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [b a b a b]\r\ny = reverse_ascending(x)\r\ny_correct = [b b a b a]\r\nassert(isequal(y,y_correct))\r\n\r\n%% strictly increasing\r\nx = [randi([10,20]) : randi([25,35]) ]\r\ny = reverse_ascending(x)\r\ny_correct = x(end:-1:1)\r\nassert(isequal(y,y_correct))\r\n\r\n%% strictly decreasing\r\nx = sort(unique(randi([1,99], 1, randi([10,25]))), 'descend')\r\ny = reverse_ascending(x)\r\ny_correct = x\r\nassert(isequal(y,y_correct))\r\n\r\n%% increasing than decreasing\r\na = [randi([10,20]) : randi([25,35]) ];\r\nb = sort(unique(randi([50,99], 1, randi([10,25]))), 'descend');\r\nx = [a b]\r\ny = reverse_ascending(x)\r\ny_correct = [b(1) a(end:-1:1) b(2:end)]\r\nassert(isequal(y,y_correct))\r\n\r\n%% constant\r\nx = randi([2,10])*ones(1,randi([2,10]))\r\ny = reverse_ascending(x)\r\ny_correct = x\r\nassert(isequal(y,y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":208445,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-06-02T11:24:05.000Z","updated_at":"2024-06-02T11:24:05.000Z","published_at":"2024-06-02T11:24:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate and return a new array that contains the same elements as the input array, but with the elements within each strictly increasing maximal subsequence reversed. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven the input array \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[5, 7, 10, 4, 2, 7, 8, 1, 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, the strictly increasing maximal subsequences are \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[5, 7, 10]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[2, 7, 8]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[1, 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Reversing these subsequences gives \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[10, 7, 5]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[8, 7, 2]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[3, 1]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, respectively. The output array is thus \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[10, 7, 5, 4, 8, 7, 2, 3, 1]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1844,"title":"Create a v-notch vector without \"sort\" function","description":"Given a vector vec, create a v-shaped vector as shown below: vec = [ 10 2 3 89 5 7 90 0 12]\r\nOutput vector = [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90]\r\nHere, all the elements of input vector are repeated in output vector, however first half part of the output vector is in descending order and rest is in ascending order. Once such output vector is plotted, it will show a v-shape on the graph. \r\nDo not use builtin sort function","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 132px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 66px; transform-origin: 407px 66px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 290.5px 8px; transform-origin: 290.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a vector vec, create a v-shaped vector as shown below: vec = [ 10 2 3 89 5 7 90 0 12]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 193px 8px; transform-origin: 193px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOutput vector = [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 361px 8px; transform-origin: 361px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHere, all the elements of input vector are repeated in output vector, however first half part of the output vector is in descending order and rest is in ascending order. Once such output vector is plotted, it will show a v-shape on the graph. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 96px 8px; transform-origin: 96px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eDo not use builtin sort function\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = vNotchVector(vec)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('vNotchVector.m');\r\nassert(isempty(strfind(filetext, 'sort')))\r\n\r\n%%\r\nvec = [ 10 2 3 89 5 7 90 0 12];\r\nvNotch= [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n\r\n%%\r\nvec = [ -8 -7 -6 -5 0 3 67 100 100 400];\r\nvNotch= [400 100 100 67 3 0 -5 -6 -7 -8 -8 -7 -6 -5 0 3 67 100 100 400];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n\r\n%%\r\nvec= [1 0 1 0 1 0 1 0 1 0 1 0];\r\nvNotch = [1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1  1 1 1 1 1];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n\r\n%%\r\nvec= 1:10;\r\nvNotch = [10:-1:1 1:10];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":33,"test_suite_updated_at":"2021-05-31T13:43:11.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-08-22T21:21:29.000Z","updated_at":"2021-05-31T13:44:34.000Z","published_at":"2013-08-22T21:21:29.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector vec, create a v-shaped vector as shown below: vec = [ 10 2 3 89 5 7 90 0 12]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput vector = [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHere, all the elements of input vector are repeated in output vector, however first half part of the output vector is in descending order and rest is in ascending order. Once such output vector is plotted, it will show a v-shape on the graph. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDo not use builtin sort function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":56523,"title":"Cricket - Sort Batters by Distance Run","description":"Given a string vector of batters' names, a vector of the total number of runs they scored, a vector of the number of 4s they scored, and a vector of the number of 6s, return a string array of the player's names sorted according to how far they actually ran for their runs, from farthest to least. You can assume that 4s and 6s were not run at all (so the problem is equivalent to sorting according to the number of runs scored not from boundaries).\r\nFor example,\r\n\r\nname = [\"Matt\";\"Ben\";\"Renee\"];\r\nruns = [6;18;20];\r\nfours = [0;2;3];\r\nsixes = [0;0;1];\r\n\r\nsortednames = sortbyrundistance(name,runs,fours,sixes)\r\nsortednames = \r\n  3×1 string array\r\n    \"Ben\"\r\n    \"Matt\"\r\n    \"Renee\"\r\nHere, Matt has run 6 runs, Ben 10 (8 of his total 18 came from 4s), Renee 2 (18 of her 20 runs came from boundaries).\r\nA batter's score is the total of runs physically run and runs scored from boundaries (hitting the ball to the boundary scores an automatic 4 runs, hitting it over the boundary scores an automatic 6 runs). The score is typically reported as the total runs scored, along with the number of boundary 4s and 6s. In the above example, Ben's score is 18 runs (total), including 2 4s and 0 6s. Hence, his score was 10 runs he actually ran, plus 8 runs from boundaries.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 652.267px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 326.133px; transform-origin: 407px 326.133px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 371px 8px; transform-origin: 371px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string vector of batters' names, a vector of the total number of runs they scored, a vector of the number of 4s they scored, and a vector of the number of 6s, return a string array of the player's names sorted according to how far they actually ran for their runs, from farthest to least. You can assume that 4s and 6s were not run at all (so the problem is equivalent to sorting according to the number of runs scored \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.5px 8px; transform-origin: 11.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 58px 8px; transform-origin: 58px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e from boundaries).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 41px 8px; transform-origin: 41px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example,\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 170.5px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 85.25px; text-align: left; transform-origin: 384px 85.25px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline;width: 324px;height: 165px\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQ8AAAKTCAMAAACAZA4rAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEaUExURQAAAABSewBMhwBNhgBLiABKhwBLhgAAAABLhwYHCAgICAsOEBAQEBBWjhEVGBZelhccIBddlhgYGBwjKCAgICBhliBiliIqMCJmnSJnnigoKCgxOC04QC1wpTAwMDBtnTBtnjM/SDg4ODhGUD5NWD94pUBAQEB4pUOCtEODtERUYEhISElbaE9icFBQUFVoeFhYWFpvf1qVw192h1+PtGBgYGV8j2Wey2hoaGuDl3BwcHCKn3aRp3h4eHyYr39/f3+lw4Gft4eHh4emv4e54Yytx4+Pj4+wy5K0z5eXl5i7153C35+fn6PJ56enp6nQ767X96+vr7Te/7e3t7+/v7/S4cfHx8/Pz9fX19/f3+fn5+/v7/f39////8eGjJwAAAAHdFJOUwAfQExYZHAd7kVNAAAACXBIWXMAADLAAAAywAEoZFrbAABT7ElEQVR4Xu2de3/UyJKmz84501rbLMsadtg1PuxwGc8cLg0eBgYaGgY8sDQ3G+PlYpvv/zVWIUVKmSqpKlNvGFPK9/mrKktdbfSLepSZEZn5p//yS8mf/46M5i9yB/U1GcPflzfw7/U1GYOE4F/0NRnBn+UO/pc//elPv/xXQgghv9CHhBBSQR8SQkgNfUgIITXiw7/Ii3/5VzKav8od1NdkDP+9vIH/XV+TMUgI/lVfkxH8i9zBv5Q+/Dt58Z/7ZDR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KQPAehDM+hDFPoQRUKQPgSgD82gD1HoQxQJQfoQgD40gz5EoQ9RJATpQwD60Az6EIU+RJEQpA8B6EMz6EMU+hBFQpA+BKAPzaAPUehDFAlB+hCAPjSDPkShD1EkBOlDgMaHfy8v/tdfyWj+h9zBfybj+W/lDfxv+pqMQULwf+prMoL/I3fw70sf/iIvCCEkc36hDwkhpII+JISQGvqQEEJqxIeEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhPww/vSn/w+Hk269rvlYfAAAAABJRU5ErkJggg==\" alt=\"Table showing runs, fours, and sixes for three batters. Matt has 6 runs, 0 fours, 0 sixes. Ben has 18 runs, 2 fours, 0 sixes. Renee has 20 runs, 3 fours, 1 six.\" data-image-state=\"image-loaded\" width=\"324\" height=\"165\"\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 224.767px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 112.383px; transform-origin: 404px 112.383px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 120px 8.5px; tab-size: 4; transform-origin: 120px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003ename = [\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e\"Matt\"\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e\"Ben\"\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 28px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 28px 8.5px; \"\u003e\"Renee\"\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 8px 8.5px; transform-origin: 8px 8.5px; \"\u003e];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 68px 8.5px; tab-size: 4; transform-origin: 68px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eruns = [6;18;20];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 64px 8.5px; tab-size: 4; transform-origin: 64px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003efours = [0;2;3];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 64px 8.5px; tab-size: 4; transform-origin: 64px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esixes = [0;0;1];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 216px 8.5px; tab-size: 4; transform-origin: 216px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esortednames = sortbyrundistance(name,runs,fours,sixes)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 56px 8.5px; tab-size: 4; transform-origin: 56px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esortednames = \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 72px 8.5px; tab-size: 4; transform-origin: 72px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 12px 8.5px; transform-origin: 12px 8.5px; \"\u003e  3\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(255, 0, 0); border-block-start-color: rgb(255, 0, 0); border-bottom-color: rgb(255, 0, 0); border-inline-end-color: rgb(255, 0, 0); border-inline-start-color: rgb(255, 0, 0); border-left-color: rgb(255, 0, 0); border-right-color: rgb(255, 0, 0); border-top-color: rgb(255, 0, 0); caret-color: rgb(255, 0, 0); color: rgb(255, 0, 0); column-rule-color: rgb(255, 0, 0); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(255, 0, 0); perspective-origin: 4px 8.5px; text-decoration-color: rgb(255, 0, 0); text-emphasis-color: rgb(255, 0, 0); transform-origin: 4px 8.5px; \"\u003e×\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 36px 8.5px; transform-origin: 36px 8.5px; \"\u003e1 string \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003earray\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 36px 8.5px; tab-size: 4; transform-origin: 36px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e\"Ben\"\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 40px 8.5px; tab-size: 4; transform-origin: 40px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e\"Matt\"\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 44px 8.5px; tab-size: 4; transform-origin: 44px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 28px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 28px 8.5px; \"\u003e\"Renee\"\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374px 8px; transform-origin: 374px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHere, Matt has run 6 runs, Ben 10 (8 of his total 18 came from 4s), Renee 2 (18 of her 20 runs came from boundaries).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA batter's score is the total of runs physically run and runs scored from boundaries (hitting the ball to the boundary scores an automatic 4 runs, hitting it over the boundary scores an automatic 6 runs). The score is typically reported as the total runs scored, along with the number of boundary 4s and 6s. In the above example, Ben's score is 18 runs (total), including 2 4s and 0 6s. Hence, his score was 10 runs he actually ran, plus 8 runs from boundaries.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function name = sortbyrundistance(name,runs,fours,sixes)\r\nname = sort(name);\r\nend","test_suite":"%% Farewell, Little Master\r\nname = [\"Murali Vijay\";\"Shikhar Dhawan\";\"Cheteshwar Pujara\";\"Sachin Tendulkar\";\"Virat Kohli\";\"Rohit Sharma\";\"MS Dhoni\";\"Ravichandran Ashwin\";\"Bhuvneshwar Kumar\";\"Pragyan Ojha\";\"Mohammed Shami\"];\r\nruns = [43;33;113;74;57;111;4;30;4;0;11];\r\nfours = [8;7;12;12;5;11;0;4;1;0;2];\r\nsixes = [0;0;0;0;0;3;0;1;0;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Cheteshwar Pujara\";\"Rohit Sharma\";\"Virat Kohli\";\"Sachin Tendulkar\";\"Murali Vijay\";\"Ravichandran Ashwin\";\"Shikhar Dhawan\";\"MS Dhoni\";\"Mohammed Shami\";\"Bhuvneshwar Kumar\";\"Pragyan Ojha\"]) )\r\n%% IPL 2022\r\nname = [\"Yashasvi Jaiswal\";\"Jos Buttler\";\"Sanju Samson\";\"Devdutt Padikkal\";\"Shimron Hetmyer\";\"Ravichandran Ashwin\";\"Riyan Parag\";\"Trent Boult\";\"Obed McCoy\";\"Prasidh Krishna\"];\r\nruns = [22;39;14;2;11;6;15;11;8;0];\r\nfours = [1;5;2;0;2;0;1;0;0;0];\r\nsixes = [2;0;0;0;0;0;0;1;1;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Jos Buttler\";\"Riyan Parag\";\"Yashasvi Jaiswal\";\"Sanju Samson\";\"Ravichandran Ashwin\";\"Trent Boult\";\"Shimron Hetmyer\";\"Devdutt Padikkal\";\"Obed McCoy\";\"Prasidh Krishna\"]) )\r\n%% Inaugural WTC\r\nname = [\"Tom Latham\";\"Devon Conway\";\"Kane Williamson\";\"Ross Taylor\";\"Henry Nicholls\";\"BJ Watling\";\"Colin de Grandhomme\";\"Kyle Jamieson\";\"Tim Southee\";\"Neil Wagner\";\"Trent Boult\"];\r\nruns = [30;54;49;11;7;1;13;21;30;0;7];\r\nfours = [3;6;6;2;1;0;1;0;1;0;1];\r\nsixes = [0;0;0;0;0;0;0;1;2;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Devon Conway\";\"Kane Williamson\";\"Tom Latham\";\"Kyle Jamieson\";\"Tim Southee\";\"Colin de Grandhomme\";\"Ross Taylor\";\"Henry Nicholls\";\"Trent Boult\";\"BJ Watling\";\"Neil Wagner\"]) )\r\n%% Don Debut\r\nname = [\"Bill Woodfull\";\"Bill Ponsford\";\"Alan Kippax\";\"Stork Hendry\";\"Charles Kelleway\";\"Jack Ryder\";\"Donald Bradman\";\"Bert Oldfield\";\"Clarrie Grimmett\";\"Bert Ironmonger\"];\r\nruns = [0;2;16;30;8;33;18;2;7;4];\r\nfours = [0;0;3;4;1;3;4;0;1;0];\r\nsixes = [0;0;0;0;0;0;0;0;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Jack Ryder\";\"Stork Hendry\";\"Alan Kippax\";\"Charles Kelleway\";\"Bert Ironmonger\";\"Clarrie Grimmett\";\"Bill Ponsford\";\"Donald Bradman\";\"Bert Oldfield\";\"Bill Woodfull\"]) )\r\n%% T20 WC 2022 Subcontinental Heart Attack\r\nname = [\"Mohammad Rizwan\";\"Babar Azam\";\"Shan Masood\";\"Iftikhar Ahmed\";\"Shadab Khan\";\"Haider Ali\";\"Mohammad Nawaz\";\"Asif Ali\";\"Shaheen Shah Afridi\";\"Haris Rauf\"];\r\nruns = [4;0;52;51;5;2;9;2;16;6];\r\nfours = [1;0;5;2;1;0;2;0;1;0];\r\nsixes = [0;0;0;4;0;0;0;0;1;1];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Shan Masood\";\"Iftikhar Ahmed\";\"Shaheen Shah Afridi\";\"Haider Ali\";\"Asif Ali\";\"Shadab Khan\";\"Mohammad Nawaz\";\"Mohammad Rizwan\";\"Babar Azam\";\"Haris Rauf\"]) )\r\n%% Lara Breaks a Record\r\nname = [\"Phil Simmons\";\"Stuart Williams\";\"Brian Lara\";\"Jimmy Adams\";\"Keith Arthurton\";\"Shivnarine Chanderpaul\"];\r\nruns = [8;3;375;59;47;75];\r\nfours = [0;0;45;2;5;10];\r\nsixes = [0;0;0;2;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Brian Lara\";\"Jimmy Adams\";\"Shivnarine Chanderpaul\";\"Keith Arthurton\";\"Phil Simmons\";\"Stuart Williams\"]) )\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":287,"edited_by":287,"edited_at":"2022-11-08T15:09:23.000Z","deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-11-07T19:56:18.000Z","updated_at":"2025-12-06T06:35:55.000Z","published_at":"2022-11-08T15:09:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string vector of batters' names, a vector of the total number of runs they scored, a vector of the number of 4s they scored, and a vector of the number of 6s, return a string array of the player's names sorted according to how far they actually ran for their runs, from farthest to least. You can assume that 4s and 6s were not run at all (so the problem is equivalent to sorting according to the number of runs scored \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e from boundaries).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"165\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"324\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"Table showing runs, fours, and sixes for three batters. Matt has 6 runs, 0 fours, 0 sixes. Ben has 18 runs, 2 fours, 0 sixes. Renee has 20 runs, 3 fours, 1 six.\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[name = [\\\"Matt\\\";\\\"Ben\\\";\\\"Renee\\\"];\\nruns = [6;18;20];\\nfours = [0;2;3];\\nsixes = [0;0;1];\\n\\nsortednames = sortbyrundistance(name,runs,fours,sixes)\\nsortednames = \\n  3×1 string array\\n    \\\"Ben\\\"\\n    \\\"Matt\\\"\\n    \\\"Renee\\\"]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHere, Matt has run 6 runs, Ben 10 (8 of his total 18 came from 4s), Renee 2 (18 of her 20 runs came from boundaries).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA batter's score is the total of runs physically run and runs scored from boundaries (hitting the ball to the boundary scores an automatic 4 runs, hitting it over the boundary scores an automatic 6 runs). The score is typically reported as the total runs scored, along with the number of boundary 4s and 6s. In the above example, Ben's score is 18 runs (total), including 2 4s and 0 6s. Hence, his score was 10 runs he actually ran, plus 8 runs from boundaries.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.png\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQ8AAAKTCAMAAACAZA4rAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEaUExURQAAAABSewBMhwBNhgBLiABKhwBLhgAAAABLhwYHCAgICAsOEBAQEBBWjhEVGBZelhccIBddlhgYGBwjKCAgICBhliBiliIqMCJmnSJnnigoKCgxOC04QC1wpTAwMDBtnTBtnjM/SDg4ODhGUD5NWD94pUBAQEB4pUOCtEODtERUYEhISElbaE9icFBQUFVoeFhYWFpvf1qVw192h1+PtGBgYGV8j2Wey2hoaGuDl3BwcHCKn3aRp3h4eHyYr39/f3+lw4Gft4eHh4emv4e54Yytx4+Pj4+wy5K0z5eXl5i7153C35+fn6PJ56enp6nQ767X96+vr7Te/7e3t7+/v7/S4cfHx8/Pz9fX19/f3+fn5+/v7/f39////8eGjJwAAAAHdFJOUwAfQExYZHAd7kVNAAAACXBIWXMAADLAAAAywAEoZFrbAABT7ElEQVR4Xu2de3/UyJKmz84501rbLMsadtg1PuxwGc8cLg0eBgYaGgY8sDQ3G+PlYpvv/zVWIUVKmSqpKlNvGFPK9/mrKktdbfSLepSZEZn5p//yS8mf/46M5i9yB/U1GcPflzfw7/U1GYOE4F/0NRnBn+UO/pc//elPv/xXQgghv9CHhBBSQR8SQkgNfUgIITXiw7/Ii3/5VzKav8od1NdkDP+9vIH/XV+TMUgI/lVfkxH8i9zBv5Q+/Dt58Z/7ZDRVMOprMgZ5ovxVX5MxSAj+q74mI/hPuYN/Rx8aQB+i0IcoEoL0IQB9aAZ9iEIfokgI0ocA9KEZ9CEKfYgiIUgfAtCHZtCHKPQhioQgfQhAH5pBH6LQhygSgvQhAH1oBn2IQh+iSAjShwD0oRn0IQp9iCIhSB8C0Idm0Ico9CGKhCB9CEAfmkEfotCHKBKC9CEAfW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ISQGvqQEEJqxIeEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhPww/vSn/w+Hk269rvlYfAAAAABJRU5ErkJggg==\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46576,"title":"Award medals to winners","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 246.167px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 123.083px; transform-origin: 407px 123.083px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8.16667px; transform-origin: 384px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 102.167px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 51.0833px; transform-origin: 391px 51.0833px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 362.483px 8.16667px; transform-origin: 362.483px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 190.967px 8.16667px; transform-origin: 190.967px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 347.725px 8.16667px; transform-origin: 347.725px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 360.817px 8.16667px; transform-origin: 360.817px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 145.983px 8.16667px; transform-origin: 145.983px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eP.S.: For a competition with different rules, see \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46573\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8.16667px; transform-origin: 1.94167px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [w1,w2,w3] = medalists(x)\r\n   w1 = ...;   %  Gold\r\n   w2 = ...;   %  Silver\r\n   w3 = ...;   %  Bronze\r\nend","test_suite":"%%\r\nx = [1 5 2 6 3 7];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,4,2);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([4 6],[],[5]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [33 33 33 12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([7 9],[],[1 2 3 8]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal([1 4 10],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 10 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,[1 4 11],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9 0 -1 15 pi 12];\r\n[w1_correct,w2_correct,w3_correct] = deal(13,15,[1 4 10]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%% \r\nx = [1 5 2 5 3 5 4 5];\r\n[w1_correct,w2_correct,w3_correct] = deal([2 4 6 8],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":"2020-10-02T21:23:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-06T22:20:31.000Z","updated_at":"2020-10-02T21:23:33.000Z","published_at":"2020-09-06T22:40:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eP.S.: For a competition with different rules, see \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46573\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44261,"title":"Multivariate polynomials - sort monomials","description":"In \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44260-multidimensional-polynomials-convert-monomial-form-to-array Problem 44260\u003e, multivariate polynomials were defined as a sum of monomial terms using|exponents|, a matrix of integers, and|coefficients|, a vector (follow the above link for an explanation).  It can be useful to order the monomials. But first we need to define the total degree of a monomial as the sum of the exponents. For example, the total degree of |5*x| is 1 and the total degree of |x^3*y^5*z| is 9.\r\n\r\nWrite a function \r\n\r\n  function [coeffs,exponents] = sortMonomials(coeffs,exponents)\r\n\r\nto sort the monomials. Sort them first by descending total degree, and then for a given total degree, by lexicographical order of the exponents (by the first exponent, then the second, and so on, each in descending order). The coefficients should be sorted so they stay with the correct monomial.\r\n\r\nExample: Consider the polynomial |p(x,y,z) = 3*x - 2 + y^2 +4*z^2|, which is represented as:\r\n\r\n  exponents = [1 0 0; 0 0 0; 0 2 0; 0 0 2], coefficients = [3; -2; 1; 4]\r\n\r\nThe sorted version is\r\n\r\n  exponents = [0 2 0; 0 0 2; 1 0 0; 0 0 0], coefficients = [1; 3; 1; 4].\r\n\r\nYou can assume that a given combination of exponents is never repeated.","description_html":"\u003cp\u003eIn \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44260-multidimensional-polynomials-convert-monomial-form-to-array\"\u003eProblem 44260\u003c/a\u003e, multivariate polynomials were defined as a sum of monomial terms using|exponents|, a matrix of integers, and|coefficients|, a vector (follow the above link for an explanation).  It can be useful to order the monomials. But first we need to define the total degree of a monomial as the sum of the exponents. For example, the total degree of \u003ctt\u003e5*x\u003c/tt\u003e is 1 and the total degree of \u003ctt\u003ex^3*y^5*z\u003c/tt\u003e is 9.\u003c/p\u003e\u003cp\u003eWrite a function\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003efunction [coeffs,exponents] = sortMonomials(coeffs,exponents)\r\n\u003c/pre\u003e\u003cp\u003eto sort the monomials. Sort them first by descending total degree, and then for a given total degree, by lexicographical order of the exponents (by the first exponent, then the second, and so on, each in descending order). The coefficients should be sorted so they stay with the correct monomial.\u003c/p\u003e\u003cp\u003eExample: Consider the polynomial \u003ctt\u003ep(x,y,z) = 3*x - 2 + y^2 +4*z^2\u003c/tt\u003e, which is represented as:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eexponents = [1 0 0; 0 0 0; 0 2 0; 0 0 2], coefficients = [3; -2; 1; 4]\r\n\u003c/pre\u003e\u003cp\u003eThe sorted version is\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eexponents = [0 2 0; 0 0 2; 1 0 0; 0 0 0], coefficients = [1; 3; 1; 4].\r\n\u003c/pre\u003e\u003cp\u003eYou can assume that a given combination of exponents is never repeated.\u003c/p\u003e","function_template":"function [coeffs,exponents] = sortMonomials(coeffs,exponents)\r\ncoeffs = 0;\r\nexponents = 0;\r\nend","test_suite":"%% Test sortMonomials\r\nfiletext = fileread('sortMonomials.m');\r\nassert(~contains(filetext,'regexp'))\r\n\r\n%%\r\nunsortedCoeffs = [-10 7 -10 -7 6 6 3 1 -7 2]';\r\nunsortedExponents = [5 4 2; 2 5 3; 2 1 5; 1 5 4; 1 4 3; 1 3 3; 1 2 1; 0 4 1; 0 2 1; 0 0 5];\r\n[sortedCoeffs,sortedExponents] = sortMonomials(unsortedCoeffs,unsortedExponents);\r\nsortOrder = [1 2 4 3 5 6 8 10 7 9];\r\nassert(isequal(sortedCoeffs,unsortedCoeffs(sortOrder)))\r\nassert(isequal(sortedExponents,unsortedExponents(sortOrder,:)))\r\n\r\n%%\r\nx = randi(1000); y = randi(1000);\r\n[coeffs,exponents] = sortMonomials(x,y);\r\nassert(isequal([x y],[coeffs exponents]))\r\n\r\n%%\r\nunsortedCoeffs = randi(1000,[4 1]);\r\nough = ['hguot '; 'hguoc '; 'hguolp'; 'hguod '];\r\nunsortedExponents = ough - repmat(randi(100),size(ough));\r\nunsortedExponents = [unsortedExponents -sum(unsortedExponents,2)];\r\n[sortedCoeffs,~] = sortMonomials(unsortedCoeffs,unsortedExponents);\r\n[~,ia] = sort(ough(:,5));\r\nassert(isequal(sortedCoeffs,flipud(unsortedCoeffs(ia))))\r\n\r\n%%\r\nz = [1 3 5+randi(10)];\r\nv1 = perms(z); \r\nv2 = perms(z+[1 0 0]);\r\nv = [v2; v1];\r\nunsortedCoeffs = randi(1000,[size(v,1) 1]);\r\nunsortedExponents = v(randperm(size(v,1)),:);\r\n[sortedCoeffs,sortedExponents] = sortMonomials(unsortedCoeffs,unsortedExponents);\r\nassert(isequal(sortedExponents,v))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":1011,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-07-13T18:24:47.000Z","updated_at":"2017-07-15T05:42:59.000Z","published_at":"2017-07-13T18:25:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44260-multidimensional-polynomials-convert-monomial-form-to-array\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44260\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, multivariate polynomials were defined as a sum of monomial terms using|exponents|, a matrix of integers, and|coefficients|, a vector (follow the above link for an explanation). It can be useful to order the monomials. But first we need to define the total degree of a monomial as the sum of the exponents. For example, the total degree of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e5*x\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is 1 and the total degree of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex^3*y^5*z\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is 9.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[function [coeffs,exponents] = sortMonomials(coeffs,exponents)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eto sort the monomials. Sort them first by descending total degree, and then for a given total degree, by lexicographical order of the exponents (by the first exponent, then the second, and so on, each in descending order). The coefficients should be sorted so they stay with the correct monomial.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample: Consider the polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep(x,y,z) = 3*x - 2 + y^2 +4*z^2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, which is represented as:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[exponents = [1 0 0; 0 0 0; 0 2 0; 0 0 2], coefficients = [3; -2; 1; 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe sorted version is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[exponents = [0 2 0; 0 0 2; 1 0 0; 0 0 0], coefficients = [1; 3; 1; 4].]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou can assume that a given combination of exponents is never repeated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2344,"title":"N-Dimensional Sorting","description":"Given two N-dimensional matrices A and B, first sort A in increasing order and then sort B with respect to the index of A.\r\n \r\nYou produce sorted B as output. Normally the sort command does not work as the dimension increases. You must find a way to apply the sort command to an N-dimensional matrix.\r\n\r\nExample \r\n\r\n A(:,:,1) =\r\n\r\n    33    29\r\n    26    28\r\n\r\n\r\n A(:,:,2) =\r\n\r\n    13    35\r\n    22     3\r\n\r\n\r\n B(:,:,1) =\r\n\r\n    31    55\r\n    26    38\r\n\r\n\r\n B(:,:,2) =\r\n\r\n    59    51\r\n    36    29\r\n\r\n\r\n Bsorted(:,:,1) =\r\n\r\n    26    38\r\n    31    55\r\n\r\n\r\n Bsorted(:,:,2) =\r\n\r\n    59    29\r\n    36    51","description_html":"\u003cp\u003eGiven two N-dimensional matrices A and B, first sort A in increasing order and then sort B with respect to the index of A.\u003c/p\u003e\u003cp\u003eYou produce sorted B as output. Normally the sort command does not work as the dimension increases. You must find a way to apply the sort command to an N-dimensional matrix.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e A(:,:,1) =\u003c/pre\u003e\u003cpre\u003e    33    29\r\n    26    28\u003c/pre\u003e\u003cpre\u003e A(:,:,2) =\u003c/pre\u003e\u003cpre\u003e    13    35\r\n    22     3\u003c/pre\u003e\u003cpre\u003e B(:,:,1) =\u003c/pre\u003e\u003cpre\u003e    31    55\r\n    26    38\u003c/pre\u003e\u003cpre\u003e B(:,:,2) =\u003c/pre\u003e\u003cpre\u003e    59    51\r\n    36    29\u003c/pre\u003e\u003cpre\u003e Bsorted(:,:,1) =\u003c/pre\u003e\u003cpre\u003e    26    38\r\n    31    55\u003c/pre\u003e\u003cpre\u003e Bsorted(:,:,2) =\u003c/pre\u003e\u003cpre\u003e    59    29\r\n    36    51\u003c/pre\u003e","function_template":"function Bsorted = N_Dim_sort(A,B)\r\n \r\nBsorted=A,B\r\nend","test_suite":"%%\r\nA(:,:,1) =[33    29\r\n    26    28]\r\n\r\n A(:,:,2) =[ 13    35\r\n    22     3]\r\n\r\n B(:,:,1) =[31    55\r\n    26    38]\r\n\r\n B(:,:,2) =[59    51\r\n    36    29]\r\n\r\n Bsorted(:,:,1) =[26    38\r\n    31    55]\r\n\r\n Bsorted(:,:,2) =[59    29\r\n    36    51]\r\n\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA(:,:,1) =[22    21    21     9    10\r\n     8    28     5     4     8\r\n    26    23    22    39     4\r\n    39    20    28     1    15\r\n    22    13     6     5     1\r\n    20    25    32     1    25\r\n    32    37    16     9    20\r\n     4    28    36     1    13\r\n    36    38    13    26    30\r\n     1     4     3    21    34]\r\n\r\n\r\nA(:,:,2) =[11    14    34    14    38\r\n    21    11    16    12    25\r\n    18    23     7    36    16\r\n    14     8    18     9    27\r\n    34    28    17     6    32\r\n    40     3    30    21    14\r\n    26     2    17    37    28\r\n     8    12    39    17     9\r\n     5     4    37     9    39\r\n    24    37    39     4    29]\r\n\r\n\r\nB(:,:,1) =[11    19    50    22     1\r\n    27    42     7     2    44\r\n    38    54    17    31    24\r\n    56    30    47    50     3\r\n    32    49    13    16    25\r\n    38    20     3     3    43\r\n    41    33    27    15    56\r\n    56    24    57    40    60\r\n    10    54    16    20    60\r\n    25    41    35    40    54]\r\n\r\n\r\nB(:,:,2) =[52    23    35    18     4\r\n    49    17    49    45     8\r\n    34    10    40     7    28\r\n    26    38    53    48    41\r\n     8    19    55    47    52\r\n    40    58    10    32    30\r\n    52    30    12    16     3\r\n    17    45    48     5    19\r\n    51     1     4    38    39\r\n     5    37    24     2    48]\r\n\r\n\r\nBsorted(:,:,1) =[25    41    35    50    25\r\n    56    49     7     3    24\r\n    27    30    13    40    44\r\n    38    19    16     2     1\r\n    11    54    27    16    60\r\n    32    20    50    22     3\r\n    38    42    17    15    56\r\n    41    24    47    40    43\r\n    10    33     3    20    60\r\n    56    54    57    31    54]\r\n\r\n\r\nBsorted(:,:,2) =[51    30    40     2    19\r\n    17    58    49    47    30\r\n    52     1    55    48    28\r\n    26    38    12    38     8\r\n    34    17    53    45    41\r\n    49    45    10    18     3\r\n     5    23    35     5    48\r\n    52    10     4    32    52\r\n     8    19    48     7     4\r\n    40    37    24    16    39]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA(:,:,1) =[1    13     3    33    27\r\n    16    23    26     6    15\r\n    36    20    14     5    25\r\n     1    10    23    40     7\r\n     5    40     1    34     6\r\n     8    40     3    29     6\r\n    26    34    31     8    39\r\n    20    31     3     3    25\r\n     9    33    21     4    13\r\n    22    26     8    32    12\r\n    28     6    31    13     5\r\n    30    37    24    27    29\r\n    33    11    36    32    35\r\n    37    40    33    25     1\r\n    35    19    27    23    28\r\n    22    26    25    34     7\r\n     8    27    40    19    23\r\n    22     3    24     8    31\r\n    36     2    20     1     7\r\n    22    12    27    37    20]\r\n\r\n\r\nA(:,:,2) =[ 3    17    30    20    10\r\n     5    30    16    23    31\r\n    27    18    20    29    10\r\n    20    28    29    13    27\r\n    20    37    40    26     6\r\n    15    32    34    17    22\r\n     6    19    40    26     9\r\n    29    18    39    10    21\r\n     1     1    25    31    21\r\n     7    35    10    20    22\r\n     7    18    39    14    33\r\n    38    29    39     6    32\r\n    29    15    27    26    25\r\n     7    32    17    19    38\r\n    13    25     4     2    27\r\n    28    22     5    21     4\r\n    19    25    39     1     3\r\n     1     6    38     1    32\r\n    14    28    34    24    17\r\n    32    20     1    29    10]\r\n\r\n\r\nA(:,:,3) =[31    20    16    26    16\r\n    23    18     9    11     2\r\n    27    16     2     5    27\r\n     6    18    10    37    32\r\n    25    31    10     2    39\r\n    22    18     8    15    23\r\n    38     1    34    23    27\r\n     1    11    25    19     9\r\n     4    20    29    21    21\r\n    27    25    22    19    26\r\n    19    12    16    30    14\r\n    15    14    20    27    24\r\n    20     5    14    40     7\r\n    10    31    26    39     4\r\n    13    19    38    19    24\r\n     4    25    26     4    15\r\n    37    23    25    36     9\r\n    23    28    30     9     3\r\n     6    21    24    39    20\r\n    20     6    36    37    29]\r\n\r\n\r\nA(:,:,4) =[10    23     2    33    20\r\n     8    11     8    36    34\r\n     3     3    34     6     3\r\n    18     8     7    39    14\r\n    10    16    14    17    17\r\n    18    37    16     7    13\r\n    30     9    27     7    23\r\n     9     3    18    23    19\r\n    25    15    24     8    31\r\n    14    34     8    12    28\r\n     5    40    15    30    29\r\n    33     9    16    39    20\r\n     3    29    21    26    19\r\n    26    40    33     9    21\r\n    32    39     4     6    16\r\n     1     4     9     2    37\r\n    11     3    31    15    26\r\n    40    19    36     8    34\r\n    27    27    36     2    26\r\n    13     5    38    27     7]\r\n\r\n\r\nB(:,:,1) =[7    56    21    23    25\r\n    19    11    31    37     5\r\n    21    23    32    58    52\r\n    44    39    56    60    22\r\n    46    29    15     5    52\r\n    28     7    40    14    20\r\n    45    42    36    17    42\r\n    50    17    15    49    39\r\n    58    40    12    59    34\r\n    38    50     3     1    56\r\n     3    37    32    29    36\r\n     7     4    40    29    25\r\n    46    35    20     8    32\r\n    19    58    11    22    53\r\n    54    21    10    30    28\r\n    50    50     3    49    27\r\n    12     5    14    41    36\r\n    53    34    35     2     5\r\n    15    57    25     8     3\r\n    49    31    10    39    18]\r\n\r\n\r\nB(:,:,2) =[46     6    48    57    52\r\n    47     1    13    26    32\r\n     6    57    34    31    37\r\n    19    44    36     4    13\r\n    13    50    33    53    46\r\n     1     9    21    20    16\r\n    39    43     9    30    42\r\n    43    42    16    37    38\r\n    47    23    41    36    33\r\n    51    35    33    19    45\r\n    41    23    19    43    56\r\n    42    38    51    47    54\r\n    49    42    24    60    43\r\n     1    23    14    30    44\r\n    53    23     6    32    44\r\n    27    21     8    41    40\r\n    50    47    17     6    20\r\n    50     7    50     7    31\r\n    53    41    40    26    27\r\n    17    55    57    19     4]\r\n\r\n\r\nB(:,:,3) =[46    48    58    50    26\r\n     5     3    45    36    26\r\n    10    59    59    30    49\r\n    49    31    37     7    43\r\n    51    11    36     7     8\r\n    14     3    48    30    46\r\n     8    17    23    53    32\r\n     6     4    48     6    45\r\n    13    48    18    42    22\r\n    19    12    34     8    60\r\n     2    25    56    43    32\r\n    47     6    38    28    47\r\n    17    48     7    31     2\r\n    18    22    11    53    15\r\n    17    55    11     3    43\r\n    34    12    48    52    27\r\n    30    34    17    24    30\r\n    45    10     5     8    12\r\n    58    13    51    40    15\r\n     8    40     8    17     5]\r\n\r\n\r\nB(:,:,4) =[56    19    59     4    50\r\n    17    20    26    22    17\r\n    60    12    58    17    49\r\n    55     9    28    27    27\r\n    40    11     5    22    26\r\n    37    15    44    50    45\r\n    35    16    12    31    59\r\n    15    43    45    21    43\r\n    19    33    36    54    30\r\n    27    49     8    30    52\r\n    29    27     6    59    13\r\n    33    22    41    43    43\r\n    53    13    26    53    21\r\n    28    54    16    36    10\r\n    40     3    24    25    43\r\n    60    20    19    38    56\r\n     5     9    21    26    47\r\n    25    37    32    18    55\r\n    35    56    14    47    22\r\n    47    25    60    50     3]\r\n\r\n\r\nBsorted(:,:,1) =[7    57    15     8    53\r\n    44    34    21    49    36\r\n    46    37    40    59    52\r\n    28    39    15    58    20\r\n    12    35     3    37    22\r\n    58    31    32    17    27\r\n    19    56    25     2     3\r\n    50    21    12    29    56\r\n    38    23    56    41    34\r\n    50    11    40    30     5\r\n    53    50    35    22    18\r\n    49    50     3    29    36\r\n    45     5    31    14    52\r\n     3    17    10     1    39\r\n     7    40    10     8    25\r\n    46    42    36    23    28\r\n    54     4    32     5    25\r\n    21    29    11    49     5\r\n    15     7    20    39    32\r\n    19    58    14    60    42]\r\n\r\n\r\nBsorted(:,:,2) =[47    23    57     6    20\r\n    50     7     6     7    40\r\n    46    42     8    32    46\r\n    47     6    33    47    42\r\n    39    57    13    37    52\r\n    51    42    14     4    37\r\n    41    23    34    43     4\r\n     1    43    41    20    27\r\n    53    55    24    30    38\r\n    53    21    36    57    33\r\n     1    23    48    19    16\r\n    50    47    21    41    45\r\n    19    44    40    26    43\r\n    13    41    50    26    13\r\n     6    38    16    53    44\r\n    27     1    19    30    32\r\n    43     9    51    60    54\r\n    49    23    17    31    31\r\n    17    35    33    19    56\r\n    42    50     9    36    44]\r\n\r\n\r\nBsorted(:,:,3) =[6    17    59     7    26\r\n    13    48    48    52    12\r\n    34    40    45    30    15\r\n    49     4    37     8     2\r\n    58    25    36    36    45\r\n    18     6     7    30    30\r\n    17    59    58     6    32\r\n    47     3    56     8    27\r\n     2    31    38     3    26\r\n    17     3    34    42    15\r\n     8    55    51    53    22\r\n    14    48    48    50    46\r\n     5    48    17    28    47\r\n    45    13    11    43    43\r\n    51    34    48    24    60\r\n    10    12    18     7    49\r\n    19    12     5    17    32\r\n    46    10    23    53     5\r\n    30    11     8    40    43\r\n     8    22    11    31     8]\r\n\r\n\r\nBsorted(:,:,4) =[60    12    59    38    49\r\n    60    43    24    47     3\r\n    53     9    28    17    45\r\n    29    20    26    25    27\r\n    17    25     8    50    43\r\n    15     9    19    31    26\r\n    56    16     5    54    43\r\n    40    22     6    18    21\r\n     5    20    44    36    50\r\n    47    33    41    30    43\r\n    27    11    45    26    10\r\n    55    37    26    22    59\r\n    37    19    36    21    47\r\n    19    56    12    53    22\r\n    28    13    21    50    52\r\n    35    49    16    59    13\r\n    35    15    58     4    30\r\n    40     3    32    22    17\r\n    33    27    14    27    55\r\n    25    54    60    43    56]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA =[26    11     7     4    19\r\n    25    23    10    14    40\r\n    35    38    32    40    14\r\n    12    38    21    20    28\r\n    10     7    40    19    15]\r\n\r\n\r\nB =[48    30    24     7    54\r\n     4     5    47    30    51\r\n     7    25    27    49    22\r\n    45    11    42     5    10\r\n    20    20    60    38    33]\r\n\r\n\r\nBsorted =[20    20    24     7    22\r\n    45    30    47    30    33\r\n     4     5    42    38    54\r\n    48    25    27     5    10\r\n     7    11    60    49    51]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA(:,:,1) =[2    39    20    12\r\n    18    29    22     7]\r\n\r\n\r\nA(:,:,2) =[27    39    36    15\r\n    21    26    34    31]\r\n\r\n\r\nB(:,:,1) =[26    14     9    27\r\n    54    35     7    41]\r\n\r\n\r\nB(:,:,2) =[25    59    16    13\r\n    20    41    41    27]\r\n\r\n\r\nBsorted(:,:,1) =[26    35     9    41\r\n    54    14     7    27]\r\n\r\n\r\nBsorted(:,:,2) =[20    41    41    13\r\n    25    59    16    27]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))","published":true,"deleted":false,"likes_count":0,"comments_count":7,"created_by":22216,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-06-03T16:02:21.000Z","updated_at":"2026-03-16T14:19:46.000Z","published_at":"2014-06-03T16:22:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two N-dimensional matrices A and B, first sort A in increasing order and then sort B with respect to the index of A.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou produce sorted B as output. Normally the sort command does not work as the dimension increases. You must find a way to apply the sort command to an N-dimensional matrix.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ A(:,:,1) =\\n\\n    33    29\\n    26    28\\n\\n A(:,:,2) =\\n\\n    13    35\\n    22     3\\n\\n B(:,:,1) =\\n\\n    31    55\\n    26    38\\n\\n B(:,:,2) =\\n\\n    59    51\\n    36    29\\n\\n Bsorted(:,:,1) =\\n\\n    26    38\\n    31    55\\n\\n Bsorted(:,:,2) =\\n\\n    59    29\\n    36    51]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42809,"title":"Sorting integers by their digits (Level 1)","description":"Given a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nExample:\r\n\r\nv = [14 3 268 14 210 1 80];\r\n\r\nw = [1 14 14 210 268 3 80];\r\n\r\nAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.","description_html":"\u003cp\u003eGiven a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14 3 268 14 210 1 80];\u003c/p\u003e\u003cp\u003ew = [1 14 14 210 268 3 80];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14 3 268 14 210 1 80];\r\nw_correct = [1 14 14 210 268 3 80];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [246 24680 2468 246 24 2 24680 24 2468 2];\r\nw_correct = [2 2 24 24 246 246 2468 2468 24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":86,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-19T20:04:25.000Z","updated_at":"2026-03-16T16:49:45.000Z","published_at":"2016-04-19T20:04:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14 3 268 14 210 1 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [1 14 14 210 268 3 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1687,"title":"Poker Card Deal!","description":"Anyone want to play a card game?  \r\n\r\nWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards.  Rows are the amount of people in play, columns are the amount of cards dealt to each person.  The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\r\n\r\nThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J.  The suits are s for spades, d for dimonds, h for hearts and c for clubs.  \r\n\r\nSo the final cards look like this:\r\n\r\n'js'\r\n\r\n'J'\r\n\r\n'2h'\r\n\r\n'ad'\r\n\r\n'5c' and so on.\r\n\r\nThis function reads in three variables, these are:\r\n\r\npeople -- This is the amount of people that the cards are being dealt to.\r\n\r\ncardsDelt  -- This is the amount of cards dealt to each person.\r\n\r\nisJokerIn --  This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\r\n\r\nso an example is the following, if the variables are:\r\n\r\n%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\r\n\r\npeople = 5;\r\n\r\ncardsDelt = 5; %note, this is a typical deal for a poker game...\r\n\r\nisJokerIn = 0; \r\n\r\nThe outputs will be:\r\n\r\ndealtDeck = \r\n\r\n    'qh'    'as'    '5s'     '2s'    'jd' \r\n    'ad'    '5d'    '9s'     '7h'    'ah' \r\n    '3c'    '2d'    'ac'     '8c'    'qd' \r\n    'kh'    '5h'    '4c'     '3h'    '10s'\r\n    '6h'    '8h'    '10c'    '4s'    '8d' \r\n\r\n%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\r\n\r\ndeckLeftover = \r\n\r\n    '3s'\r\n    '4h'\r\n    '2c'\r\n    '5c'\r\n    'qs'\r\n    'jh'\r\n    'kd'\r\n    '2h'\r\n    '9c'\r\n    '10h'\r\n    '9h'\r\n    '6d'\r\n    '7c'\r\n    '7s'\r\n    '8s'\r\n    'qc'\r\n    'js'\r\n    '9d'\r\n    '7d'\r\n    'ks'\r\n    '6c'\r\n    '6s'\r\n    '3d'\r\n    '10d'\r\n    'jc'\r\n    '4d'\r\n    'kc'\r\n\r\nWell I hope that everyone has fun with it!  Thank you!\r\n\r\n","description_html":"\u003cp\u003eAnyone want to play a card game?\u003c/p\u003e\u003cp\u003eWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards.  Rows are the amount of people in play, columns are the amount of cards dealt to each person.  The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\u003c/p\u003e\u003cp\u003eThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J.  The suits are s for spades, d for dimonds, h for hearts and c for clubs.\u003c/p\u003e\u003cp\u003eSo the final cards look like this:\u003c/p\u003e\u003cp\u003e'js'\u003c/p\u003e\u003cp\u003e'J'\u003c/p\u003e\u003cp\u003e'2h'\u003c/p\u003e\u003cp\u003e'ad'\u003c/p\u003e\u003cp\u003e'5c' and so on.\u003c/p\u003e\u003cp\u003eThis function reads in three variables, these are:\u003c/p\u003e\u003cp\u003epeople -- This is the amount of people that the cards are being dealt to.\u003c/p\u003e\u003cp\u003ecardsDelt  -- This is the amount of cards dealt to each person.\u003c/p\u003e\u003cp\u003eisJokerIn --  This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\u003c/p\u003e\u003cp\u003eso an example is the following, if the variables are:\u003c/p\u003e\u003cp\u003e%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\u003c/p\u003e\u003cp\u003epeople = 5;\u003c/p\u003e\u003cp\u003ecardsDelt = 5; %note, this is a typical deal for a poker game...\u003c/p\u003e\u003cp\u003eisJokerIn = 0;\u003c/p\u003e\u003cp\u003eThe outputs will be:\u003c/p\u003e\u003cp\u003edealtDeck =\u003c/p\u003e\u003cpre\u003e    'qh'    'as'    '5s'     '2s'    'jd' \r\n    'ad'    '5d'    '9s'     '7h'    'ah' \r\n    '3c'    '2d'    'ac'     '8c'    'qd' \r\n    'kh'    '5h'    '4c'     '3h'    '10s'\r\n    '6h'    '8h'    '10c'    '4s'    '8d' \u003c/pre\u003e\u003cp\u003e%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\u003c/p\u003e\u003cp\u003edeckLeftover =\u003c/p\u003e\u003cpre\u003e    '3s'\r\n    '4h'\r\n    '2c'\r\n    '5c'\r\n    'qs'\r\n    'jh'\r\n    'kd'\r\n    '2h'\r\n    '9c'\r\n    '10h'\r\n    '9h'\r\n    '6d'\r\n    '7c'\r\n    '7s'\r\n    '8s'\r\n    'qc'\r\n    'js'\r\n    '9d'\r\n    '7d'\r\n    'ks'\r\n    '6c'\r\n    '6s'\r\n    '3d'\r\n    '10d'\r\n    'jc'\r\n    '4d'\r\n    'kc'\u003c/pre\u003e\u003cp\u003eWell I hope that everyone has fun with it!  Thank you!\u003c/p\u003e","function_template":"function [dealtDeck, deckLeftover] = Poker_Deal(people,cardsDelt,isJokerIn)\r\ndealtDeck ='this is the dealt deck to players'\r\ndeckLeftover = 'is the left over cards in the deck, after being delt'\r\nend","test_suite":"%%\r\npeople = 5;\r\ncardsDelt = 5;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 25) \u0026 ~issorted(reshape(dealtDeck,25,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-25)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 5;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 15) \u0026 ~issorted(reshape(dealtDeck,15,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-15)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 4;\r\ncardsDelt = 7;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 28) \u0026 ~issorted(reshape(dealtDeck,28,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-28)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 5;\r\ncardsDelt = 6;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 30) \u0026 ~issorted(reshape(dealtDeck,30,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-30)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 4;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 12) \u0026 ~issorted(reshape(dealtDeck,12,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-12)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 3;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac';  'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 9) \u0026 ~issorted(reshape(dealtDeck,9,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-9)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":15,"created_at":"2013-06-30T01:06:43.000Z","updated_at":"2026-04-02T19:37:49.000Z","published_at":"2013-06-30T01:06:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnyone want to play a card game?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards. Rows are the amount of people in play, columns are the amount of cards dealt to each person. The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J. The suits are s for spades, d for dimonds, h for hearts and c for clubs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo the final cards look like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'js'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'J'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'2h'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'ad'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'5c' and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis function reads in three variables, these are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003epeople -- This is the amount of people that the cards are being dealt to.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecardsDelt -- This is the amount of cards dealt to each person.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eisJokerIn -- This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso an example is the following, if the variables are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003epeople = 5;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecardsDelt = 5; %note, this is a typical deal for a poker game...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eisJokerIn = 0;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe outputs will be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edealtDeck =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    'qh'    'as'    '5s'     '2s'    'jd' \\n    'ad'    '5d'    '9s'     '7h'    'ah' \\n    '3c'    '2d'    'ac'     '8c'    'qd' \\n    'kh'    '5h'    '4c'     '3h'    '10s'\\n    '6h'    '8h'    '10c'    '4s'    '8d']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edeckLeftover =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    '3s'\\n    '4h'\\n    '2c'\\n    '5c'\\n    'qs'\\n    'jh'\\n    'kd'\\n    '2h'\\n    '9c'\\n    '10h'\\n    '9h'\\n    '6d'\\n    '7c'\\n    '7s'\\n    '8s'\\n    'qc'\\n    'js'\\n    '9d'\\n    '7d'\\n    'ks'\\n    '6c'\\n    '6s'\\n    '3d'\\n    '10d'\\n    'jc'\\n    '4d'\\n    'kc']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWell I hope that everyone has fun with it! Thank you!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":55285,"title":"Number of leaps in binary search","description":"Binary search is one of the most popular searching algorithms (Binary Search Algorithm). It works only in a sorted array. It utilizes the concept of decrease and conquer. At each iteration, it halves the size of the array while searching for an element in a list of items.\r\nWhile Matlab provides the 'find' or similar functions to search for an element in an array. This problem works the other way around. You have to implement the binary search algorithm here. Instead of finding the index of an element, you've to find how many jumps/iterations do you need using binary search to reach the item you are looking for.\r\n\r\nFor example, \r\ngiven array, a= [2, 4,  5, 7, 8, 9, 19] and search item value= 8.\r\nThe item is located at index 5. But thats not what you are looking for.\r\nImplementing Binary search --\r\nstep - 1: mid_elem = 7. doesn't match and lower. so shift the search to upper half. new array is [8, 9, 19].\r\nstep - 2: mid_elem = 9. doesn't match and higher. so, shift the search to lower half. new array is [8].\r\nstep - 3: mid_elem=8. match.\r\nSo, no of steps =3.\r\n\r\nIf the value is not found, return -1.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 457.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 228.65px; transform-origin: 407px 228.65px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 199.5px 8px; transform-origin: 199.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBinary search is one of the most popular searching algorithms (\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Binary_search_algorithm\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eBinary Search Algorithm\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 108px 8px; transform-origin: 108px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e). It works only in a sorted array. It utilizes the concept of decrease and conquer. At each iteration, it halves the size of the array while searching for an element in a list of items.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhile Matlab provides the 'find' or similar functions to search for an element in an array. This problem works the other way around. You have to implement the binary search algorithm here. Instead of finding the index of an element, you've to find how many jumps/iterations do you need using binary search to reach the item you are looking for.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 43px 8px; transform-origin: 43px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 194.5px 8px; transform-origin: 194.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003egiven array, a= [2, 4,  5, 7, 8, 9, 19] and search item value= 8.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 215px 8px; transform-origin: 215px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe item is located at index 5. But thats not what you are looking for.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 94px 8px; transform-origin: 94px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eImplementing Binary search --\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 61.3px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30.65px; transform-origin: 391px 30.65px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 328px 8px; transform-origin: 328px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003estep - 1: mid_elem = 7. doesn't match and lower. so shift the search to upper half. new array is [8, 9, 19].\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 311.5px 8px; transform-origin: 311.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003estep - 2: mid_elem = 9. doesn't match and higher. so, shift the search to lower half. new array is [8].\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 91px 8px; transform-origin: 91px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003estep - 3: mid_elem=8. match.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 59.5px 8px; transform-origin: 59.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSo, no of steps =3.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 107px 8px; transform-origin: 107px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf the value is not found, return -1.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":" function step = binary_step(a,val)\r\n  step = x;\r\nend","test_suite":"%%\r\na=[2,4,5,7,8,9,19];\r\nval=7;\r\ny_correct = 1;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na=[2,4,5,7,8,9,19];\r\nval=4;\r\ny_correct = 2;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na=[2,4,5,7,8,9,19];\r\nval=8;\r\ny_correct = 3;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na=[2,4,5,7,8,9,19];\r\nval=21;\r\ny_correct = -1;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= [10,14,19,26,27,31,33,35,42,44];\r\nval=31;\r\ny_correct = 3;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= [10,14,19,26,27,31,33,35,42,44];\r\nval=33;\r\ny_correct = 4;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= [10,14,19,26,27,31,33,35,42,44,3];\r\nval=33;\r\ny_correct = 4;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= randperm(200);\r\nval=47;\r\ny_correct = 8;\r\nassert(isequal(binary_step(a,val),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":363598,"edited_by":223089,"edited_at":"2022-09-14T08:41:03.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2022-09-14T08:41:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-08-12T22:28:58.000Z","updated_at":"2025-10-01T23:09:27.000Z","published_at":"2022-08-12T22:34:00.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBinary search is one of the most popular searching algorithms (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Binary_search_algorithm\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBinary Search Algorithm\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e). It works only in a sorted array. It utilizes the concept of decrease and conquer. At each iteration, it halves the size of the array while searching for an element in a list of items.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhile Matlab provides the 'find' or similar functions to search for an element in an array. This problem works the other way around. You have to implement the binary search algorithm here. Instead of finding the index of an element, you've to find how many jumps/iterations do you need using binary search to reach the item you are looking for.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven array, a= [2, 4,  5, 7, 8, 9, 19] and search item value= 8.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe item is located at index 5. But thats not what you are looking for.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImplementing Binary search --\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estep - 1: mid_elem = 7. doesn't match and lower. so shift the search to upper half. new array is [8, 9, 19].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estep - 2: mid_elem = 9. doesn't match and higher. so, shift the search to lower half. new array is [8].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estep - 3: mid_elem=8. match.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo, no of steps =3.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf the value is not found, return -1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":42815,"title":"Sorting integers by their digits (Level 3)","description":"This is the next step up from \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level-2 Problem 42811\u003e.\r\n\r\nGiven a vector, v, of real numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nExample:\r\n\r\nv = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\r\n\r\nw = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\r\n\r\nAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\r\n\r\nNegative numbers take precedence over positive numbers.","description_html":"\u003cp\u003eThis is the next step up from \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level-2\"\u003eProblem 42811\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eGiven a vector, v, of real numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\u003c/p\u003e\u003cp\u003ew = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/p\u003e\u003cp\u003eNegative numbers take precedence over positive numbers.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\r\nw_correct = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-246 -24680 2468 246 24 -2 24680 -24 -2468 2];\r\nw_correct = [-2 2 -24 24 -246 246 -2468 2468 -24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-0.22222 0.22 0.222 0.2 0.2222];\r\nw_correct = [0.2 0.22 0.222 0.2222 -0.22222];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-20T19:57:51.000Z","updated_at":"2026-03-12T02:58:05.000Z","published_at":"2016-04-20T19:57:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the next step up from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 42811\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of real numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNegative numbers take precedence over positive numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":30,"title":"Sort a list of complex numbers based on far they are from the origin.","description":"Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear first.\n\nSo if z is\n\n z = [-4 6 3+4i 1+i 0]\n\nthen the output zSorted would be\n\n zSorted = [6 3+4i -4 1+i 0]","description_html":"\u003cp\u003eGiven a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear first.\u003c/p\u003e\u003cp\u003eSo if z is\u003c/p\u003e\u003cpre\u003e z = [-4 6 3+4i 1+i 0]\u003c/pre\u003e\u003cp\u003ethen the output zSorted would be\u003c/p\u003e\u003cpre\u003e zSorted = [6 3+4i -4 1+i 0]\u003c/pre\u003e","function_template":"function zSorted = complexSort(z)\n  zSorted = z;\nend","test_suite":"%%\nj = sqrt(-1);\nz = [-4 6 3+4*j 1+j 0];\nzSorted_correct = [6 3+4*j -4 1+j 0];\nassert(isequal(complexSort(z),zSorted_correct))\n\n%%\nz = 1:10;\nzSorted_correct = 10:-1:1;\nassert(isequal(complexSort(z),zSorted_correct))","published":true,"deleted":false,"likes_count":29,"comments_count":5,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5799,"test_suite_updated_at":"2012-01-18T01:00:21.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:21.000Z","updated_at":"2026-03-29T20:41:11.000Z","published_at":"2012-01-18T01:00:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear first.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo if z is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ z = [-4 6 3+4i 1+i 0]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethen the output zSorted would be\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ zSorted = [6 3+4i -4 1+i 0]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44538,"title":"Arrange the names in alphabetical order (1)","description":"Arrange the list of names in alphabetical order. The original 'alphabetical order', that is: from α and β all the way through to ω. We might call this 'alpha-beta-cal order'!\r\nYou do not need to heed the capitalisation (uppercase versus lowercase) in determining the correct sequence, although it must be preserved in your final output.\r\nAccents or diacritics should not be heeded in determining the correct sequence, but should likewise be retained in the final output. This is consistent with some practice, albeit not universal. Only the 'tonos' will be present in the Test Suite (unless you try the optional Bonus Question).\r\nSorting should be based on the surname [family name], where present. The surname will always appear last, if present. In principle, if two surnames were alike, then one would have to next sort by the given name(s) [first name(s)] — however, that situation does not arise, and will not arise, in the Test Suite.\r\nInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\r\nEXAMPLE:\r\n % Input\r\n in = {'Δημήτρης Δραγατάκης'; 'Ρίτα Αμπατζή'}\r\n % Output\r\n out = {'Ρίτα Αμπατζή'; 'Δημήτρης Δραγατάκης'}\r\nAlthough Δ (delta, ~d) precedes Ρ (rho, ~r) in the Greek alphabet, we must sort first by surname, for which Α (alpha, ~a) precedes Δ (delta, ~d).\r\nSee also:\r\nProblem 44541","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 543.188px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 333px 271.587px; transform-origin: 333px 271.594px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eArrange the list of names in alphabetical order. The\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eoriginal\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 'alphabetical order', that is: from α and β all the way through to ω. We might call this\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e'alpha-beta-cal order'\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou do\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e need to heed the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ecapitalisation\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (uppercase versus lowercase) in determining the correct sequence, although it must be preserved in your final output.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 31.5px; text-align: left; transform-origin: 310px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eAccents\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e or diacritics should\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e be heeded in determining the correct sequence, but should likewise be retained in the final output. This is consistent with\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/List_of_Greek_place_names\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003esome practice\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, albeit\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.tlg.uci.edu/help/Doc002.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003enot universal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Only the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e'tonos'\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e will be present in the Test Suite (unless you try the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eoptional\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Bonus Question).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 42px; text-align: left; transform-origin: 310px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSorting should be based on the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003esurname\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e [family name], where present. The surname will always appear\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003elast\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, if present. In principle, if two surnames were alike, then one would have to next sort by the given name(s) [first name(s)] — however, that situation does\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e arise, and will not arise, in the Test Suite.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 10.5px; text-align: left; transform-origin: 310px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEXAMPLE:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.75px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 330px 40.875px; transform-origin: 330px 40.875px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); \"\u003e% Input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e in = {\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Δημήτρης Δραγατάκης'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e; \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Ρίτα Αμπατζή'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); \"\u003e% Output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e out = {\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Ρίτα Αμπατζή'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e; \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Δημήτρης Δραγατάκης'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAlthough Δ (delta, ~d) precedes Ρ (rho, ~r) in the Greek alphabet, we must sort first by surname, for which Α (alpha, ~a) precedes Δ (delta, ~d).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 10.5px; text-align: left; transform-origin: 310px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSee also:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4375px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 317px 10.2125px; transform-origin: 317px 10.2188px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 289px 10.2125px; text-align: left; transform-origin: 289px 10.2188px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44541\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 44541\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"% Comments ...\r\nfunction y = meSortEm( xVector )\r\n    z = x;\r\nend","test_suite":"%% Ensure generality\r\n% Don't hardcode solutions or use test-specific lookup tables.\r\n% (Lookup tables of letters are allowed, if you want, though.)\r\nRE = regexp(fileread('meSortEm.m'), '\\w+', 'match');\r\ntabooWords = {'Ἄρειος' 'Ἀριστοφάνης' 'Μαρία' 'Κάλλας' 'Φώτης' 'Καφάτος' ...\r\n        'Χρήστος' 'Δάντης' 'Διονύσιος' 'Δεμέτης' 'Γρηγόρης' 'Μπιθικώτσης' ...\r\n        'Αρετή' 'Κετιμέ' 'Παναγιώτης' 'Κόκορας' 'Ιάκωβος' 'Κολανιάν' ...\r\n        'Μαρινέλλα' 'Κώστας' 'Μουντάκης' 'Ζωρζ' 'Μουστακί'};\r\ntestResult = cellfun( @(z) ismember(z, lower(tabooWords)), lower(RE) );\r\nmsg = ['Please do not hard-code your ''solution''.' char([10 13]) 'Found: ' strjoin(RE(testResult)) '.' char([10 13])];\r\nassert(~any(  cellfun( @(z) ismember(z, lower(tabooWords)), lower(RE) )  ), msg)\r\n\r\n\r\n%% Ancient Greeks\r\n% BONUS QUESTION\r\n% More difficult due to the variety of diacritics present.\r\n% (For credit — or κῦδος — not for points.)\r\ndata = {'Αἰδεσία' 'Αἰνησίδημος' 'Αἰσάρα' 'Ἄρειος' 'Ἀριστοφάνης' ...\r\n        'Ἀριστοφῶν' 'Ἀριστώνυμος' 'Ἀσκληπιόδοτος'};\r\nL = length(data);\r\npassedTheBonusQuestion = true;\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    if ~isequal(meSortEm(input), list),\r\n        passedTheBonusQuestion = false;\r\n        disp('.')\r\n        disp('You have NOT solved the optional Bonus Question.')\r\n        disp('But you can still pass the Test Suite.')\r\n        return;\r\n    end;\r\n    %assert( isequal(meSortEm(input), list) )\r\nend;\r\ndisp('.')\r\ndisp('Congratulations:  you''ve solved the optional Bonus Question.')\r\n\r\n\r\n%% Various occupations\r\ndata = {'Γιάννα Αγγελοπούλου-Δασκαλάκη'\r\n'Οδυσσέας Αλεπουδέλλης'\r\n'Δημήτρης Βάρος'\r\n'Κική Δημουλά'\r\n'Οδυσσέας Ελύτης'\r\n'Αλέξανδρος Αρνόλδος Κωνσταντίνος Ισηγόνης'\r\n'Μαρία Κάλλας'\r\n'Κωνσταντίνος Καραθεοδωρή'\r\n'Φώτης Κ. Καφάτος'\r\n'Δημήτριος Κουκούζης'\r\n'Σπυρίδων Νικολάου Μαρινάτος'\r\n'Ντούλα Μουρίκη'\r\n'Ευστράτιος Ντελάρωφ'\r\n'Ἰωάννης Φωκᾶς'\r\n'Δημήτριος Χριστοδούλου'\r\n'Αριστοτέλης Ωνάσης'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Musicians:  A to ~G\r\ndata = {'Ρίτα Αμπατζή' 'Κώστας Ανδρέου' 'Θεόδωρος Αντωνίου' 'Γρηγόρης Ασίκης' ...\r\n        'Νικόλας Άσιμος' 'Χρήστος Δάντης' 'Διονύσιος Δεμέτης' 'Δημήτρης Δραγατάκης' ...\r\n        'Αντίοχος Ευαγγελάτος' 'Κωνσταντίνος Καραμητρούδης' 'Παύλος Καρρέρ' 'Μιλτιάδης Καρύδης' ...\r\n        'Γιώργος Μπάτης' 'Τζίνα Μπαχάουερ' 'Γρηγόρης Μπιθικώτσης' 'Μαρία Φαραντούρη' ...\r\n        'Γιάννης Χρήστου' 'Πέτρος Χριστοδουλίδης'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n%% Musicians:  ~G to K\r\ndata = {'Κατερίνα Γαρμπή'\r\n'Μιχάλης Γενίτσαρης'\r\n'Αλκίνοος Ιωαννίδης'\r\n'Λεωνίδας Καβάκος'\r\n'Στέλιος Καζαντζίδης'\r\n'Σωτήρης Κακίσης'\r\n'Μανώλης Καλομοίρης'\r\n'Ιάκωβος Καμπανέλλης'\r\n'Ελένη Καραΐνδρου'\r\n'Νίκος Καρβέλας'\r\n'Αντώνιος Κατινάρης'\r\n'Μπάμπης Κατσιώνης'\r\n'Άκης Κατσουπάκης'\r\n'Αρετή Κετιμέ'\r\n'Παναγιώτης Κόκορας'\r\n'Ιάκωβος Κολανιάν'\r\n'Σταύρος Κουγιουμτζής'\r\n'Μάνος Χατζιδάκις'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Musicians:  L to ~M\r\ndata = {'Μάνος Λοΐζος' 'Σωκράτης Μάλαμας' 'Νικόλαος Χαλικιόπουλος Μάντζαρος' ...\r\n    'Μαρινέλλα' 'Γιάννης Μαρκόπουλος' 'Κώστας Μαρτάκης' ...\r\n    'Δημήτρης Μητροπάνος' 'Δημήτρης Μητρόπουλος' 'Αθανάσιος Μικρούτσικος' ...\r\n    'Κώστας Μουντάκης' 'Ζωρζ Μουστακί' 'Οριάνθη Παναγάρη' ...\r\n    'Γεώργιος Kυριάκος Παναγιώτου' 'Δημήτρης Πανούσης' 'Βασιλική Παπαδημητρίου' ...\r\n    'Λευτέρης Παπαδόπουλος' 'Λέανδρος Παπαθανασίου' 'Αθανάσιος Παπακωνσταντίνου' ...\r\n    'Έλενα Παπαρίζου'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":64439,"edited_by":64439,"edited_at":"2025-09-14T15:36:24.000Z","deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2025-09-14T15:36:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-03-09T04:20:18.000Z","updated_at":"2025-09-15T19:47:16.000Z","published_at":"2018-03-09T10:22:08.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eArrange the list of names in alphabetical order. The\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoriginal\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 'alphabetical order', that is: from α and β all the way through to ω. We might call this\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e'alpha-beta-cal order'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou do\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e need to heed the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecapitalisation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (uppercase versus lowercase) in determining the correct sequence, although it must be preserved in your final output.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAccents\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or diacritics should\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e be heeded in determining the correct sequence, but should likewise be retained in the final output. This is consistent with\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/List_of_Greek_place_names\\\"\u003e\u003cw:r\u003e\u003cw:t\u003esome practice\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, albeit\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.tlg.uci.edu/help/Doc002.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003enot universal\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Only the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e'tonos'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e will be present in the Test Suite (unless you try the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoptional\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Bonus Question).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSorting should be based on the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esurname\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [family name], where present. The surname will always appear\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003elast\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, if present. In principle, if two surnames were alike, then one would have to next sort by the given name(s) [first name(s)] — however, that situation does\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e arise, and will not arise, in the Test Suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % Input\\n in = {'Δημήτρης Δραγατάκης'; 'Ρίτα Αμπατζή'}\\n % Output\\n out = {'Ρίτα Αμπατζή'; 'Δημήτρης Δραγατάκης'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAlthough Δ (delta, ~d) precedes Ρ (rho, ~r) in the Greek alphabet, we must sort first by surname, for which Α (alpha, ~a) precedes Δ (delta, ~d).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44541\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44541\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45193,"title":"Fun with permutations","description":"There are factorial(N) permutations of the numbers from 1 to N. For each of these permutations, we can find the set of indexes j that will return the numbers to their original order, 1:N.  For example, if we generate a random permutation p with p = randperm(1:N) then the set of indices j that will return p to the original order\r\np(j) = 1:N may be found by [~,j] = sort(p).\r\n\r\nIt sometimes happens that this set of indices j and the corresponding permutation p are the same.  For example, if p = 1:N, then j = 1:N as well; and if p = N:-1:1, then\r\nj is also N:-1:1.  However, for N = 3, there are 6 permutations in all, and it happens that only 4 of them have this property.  \r\n\r\nYour task is to determine, given the value of N, the number of permutations p of the array 1:N for which the permutation p and the indexes j are the same.\r\n\r\ninput: N, the range of the integers,\r\noutput: The number of permutations of 1:N for which isequal(p,j)\r\n\r\nHINT: For N \u003c 12, you can probably solve this by checking each of the individual permutations, but for larger N this may prove to be too time-consuming.","description_html":"\u003cp\u003eThere are factorial(N) permutations of the numbers from 1 to N. For each of these permutations, we can find the set of indexes j that will return the numbers to their original order, 1:N.  For example, if we generate a random permutation p with p = randperm(1:N) then the set of indices j that will return p to the original order\r\np(j) = 1:N may be found by [~,j] = sort(p).\u003c/p\u003e\u003cp\u003eIt sometimes happens that this set of indices j and the corresponding permutation p are the same.  For example, if p = 1:N, then j = 1:N as well; and if p = N:-1:1, then\r\nj is also N:-1:1.  However, for N = 3, there are 6 permutations in all, and it happens that only 4 of them have this property.\u003c/p\u003e\u003cp\u003eYour task is to determine, given the value of N, the number of permutations p of the array 1:N for which the permutation p and the indexes j are the same.\u003c/p\u003e\u003cp\u003einput: N, the range of the integers,\r\noutput: The number of permutations of 1:N for which isequal(p,j)\u003c/p\u003e\u003cp\u003eHINT: For N \u0026lt; 12, you can probably solve this by checking each of the individual permutations, but for larger N this may prove to be too time-consuming.\u003c/p\u003e","function_template":"function y = funWithPerms(N)\r\n  y = N;\r\nend","test_suite":"%%\r\nN = 4;\r\ny_correct = 10;\r\nassert(funWithPerms(N) == y_correct);\r\n%%\r\nN = 6;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 38);\r\n%%\r\nN = 8;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 382);\r\n%%\r\nN = 10;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 2374);\r\n%%\r\nN = 12;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 35038);\r\n%%\r\nN = 14;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 298810);\r\n%%\r\nN = 16;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 5775842);\r\n%%\r\nN = 18;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 62332114);\r\n%%\r\nN = 20;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 1484916506);\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":5,"created_by":8580,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-03T23:25:57.000Z","updated_at":"2025-11-06T15:52:17.000Z","published_at":"2019-11-03T23:41:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are factorial(N) permutations of the numbers from 1 to N. For each of these permutations, we can find the set of indexes j that will return the numbers to their original order, 1:N. For example, if we generate a random permutation p with p = randperm(1:N) then the set of indices j that will return p to the original order p(j) = 1:N may be found by [~,j] = sort(p).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIt sometimes happens that this set of indices j and the corresponding permutation p are the same. For example, if p = 1:N, then j = 1:N as well; and if p = N:-1:1, then j is also N:-1:1. However, for N = 3, there are 6 permutations in all, and it happens that only 4 of them have this property.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task is to determine, given the value of N, the number of permutations p of the array 1:N for which the permutation p and the indexes j are the same.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003einput: N, the range of the integers, output: The number of permutations of 1:N for which isequal(p,j)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHINT: For N \u0026lt; 12, you can probably solve this by checking each of the individual permutations, but for larger N this may prove to be too time-consuming.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42811,"title":"Sorting integers by their digits (Level 2)","description":"This is the next step up from \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits Problem 42809\u003e.\r\n\r\nGiven a vector, v, of integers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nExample:\r\n\r\nv = [14 3 268 -14 210 1 80];\r\n\r\nw = [1 -14 14 210 268 3 80];\r\n\r\nAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\r\n\r\nNegative integers take precedence over positive integers.","description_html":"\u003cp\u003eThis is the next step up from \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits\"\u003eProblem 42809\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eGiven a vector, v, of integers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14 3 268 -14 210 1 80];\u003c/p\u003e\u003cp\u003ew = [1 -14 14 210 268 3 80];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/p\u003e\u003cp\u003eNegative integers take precedence over positive integers.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14 3 268 -14 210 1 80];\r\nw_correct = [1 -14 14 210 268 3 80];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-246 -24680 2468 246 24 -2 24680 -24 -2468 2];\r\nw_correct = [-2 2 -24 24 -246 246 -2468 2468 -24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-20T04:50:21.000Z","updated_at":"2026-03-12T02:54:13.000Z","published_at":"2016-04-20T04:50:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the next step up from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 42809\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of integers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14 3 268 -14 210 1 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [1 -14 14 210 268 3 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNegative integers take precedence over positive integers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42498,"title":"Pancake sorting - minimum flips.","description":"Sort a stack of pancakes by flipping them using spatula.\r\nThere are N pancakes with diameters 1:N.\r\nSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\r\nSort pancakes in increasing order.\r\nReturn a vector of places where spatula was inserted.\r\nMinimize number of flips, your score will depend on the number of flips in the last few tests.\r\nReferences: math.illinois.edu, wikipedia.\r\nExample (horizontal view):\r\nInitial stack:  6 4 2 5 3 1,         (\",\" indicates position of spatula)\r\nfirst flip:     1 3 5,2 4 6\r\nsecond:         5 3 1 2 4,6\r\n...             4 2 1 3,5 6\r\n                3 1 2,4 5 6\r\n                2 1,3 4 5 6\r\nsorted!         1 2 3 4 5 6\r\n\r\npositions of spatula from the begining: 6 3 5 4 3 2","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 388.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 194.25px; transform-origin: 407px 194.25px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 175.5px 8px; transform-origin: 175.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort a stack of pancakes by flipping them using spatula.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 122.6px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 61.3px; transform-origin: 391px 61.3px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 31.5px 8px; transform-origin: 31.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThere are\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 5px 8px; transform-origin: 5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 79.5px 8px; transform-origin: 79.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e pancakes with diameters\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 11px 8px; transform-origin: 11px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e1:N\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 273px 8px; transform-origin: 273px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 108px 8px; transform-origin: 108px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort pancakes in increasing order.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 169px 8px; transform-origin: 169px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn a vector of places where spatula was inserted.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 322px 8px; transform-origin: 322px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eMinimize number of flips, your score will depend on the number of flips in the last few tests.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 38.5px 8px; transform-origin: 38.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReferences:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003emath.illinois.edu\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Pancake_sorting\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ewikipedia\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 81.5px 8px; transform-origin: 81.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample (horizontal view):\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 183.9px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 91.95px; transform-origin: 404px 91.95px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 288px 8.5px; tab-size: 4; transform-origin: 288px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003eInitial \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003estack:\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 8px 8.5px; transform-origin: 8px 8.5px; \"\u003e  \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 44px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 44px 8.5px; \"\u003e6 4 2 5 3 1\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e,         (\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 16px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 16px 8.5px; \"\u003e\",\" \u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 120px 8.5px; transform-origin: 120px 8.5px; \"\u003eindicates position of spatula)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 24px 8.5px; transform-origin: 24px 8.5px; \"\u003efirst \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003eflip:\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e     \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e1 3 5\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 24px 8.5px; transform-origin: 24px 8.5px; \"\u003e,2 4 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esecond:         5 3 1 2 4,6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); perspective-origin: 12px 8.5px; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); transform-origin: 12px 8.5px; \"\u003e...\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); perspective-origin: 96px 8.5px; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); transform-origin: 96px 8.5px; \"\u003e             4 2 1 3,5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e                3 1 2,4 5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e                2 1,3 4 5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 24px 8.5px; transform-origin: 24px 8.5px; \"\u003esorted\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(178, 140, 0); border-block-start-color: rgb(178, 140, 0); border-bottom-color: rgb(178, 140, 0); border-inline-end-color: rgb(178, 140, 0); border-inline-start-color: rgb(178, 140, 0); border-left-color: rgb(178, 140, 0); border-right-color: rgb(178, 140, 0); border-top-color: rgb(178, 140, 0); caret-color: rgb(178, 140, 0); color: rgb(178, 140, 0); column-rule-color: rgb(178, 140, 0); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(178, 140, 0); perspective-origin: 84px 8.5px; text-decoration-color: rgb(178, 140, 0); text-emphasis-color: rgb(178, 140, 0); transform-origin: 84px 8.5px; \"\u003e!         1 2 3 4 5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 204px 8.5px; tab-size: 4; transform-origin: 204px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 40px 8.5px; transform-origin: 40px 8.5px; \"\u003epositions \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 164px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 164px 8.5px; \"\u003eof spatula from the begining: 6 3 5 4 3 2\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sort_pancakes(stack)\r\n  y = 1:numel(stack);\r\nend","test_suite":"%% Coutresy of Alfonso Nieto-Castanon\r\n%urlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0\u0026amp;d=1','SetSolutionScore.p');\r\n%rehash path;\r\n\r\n%%\r\nx = 1:5;\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = [6 4 2 5 3 1];\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(12);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(13);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nfor k = 1:20\r\n  x = randperm(k);\r\n  for spatula = sort_pancakes(x)\r\n    x(1:spatula) = flip(x(1:spatula));\r\n  end\r\n  assert(issorted(x))\r\nend\r\n%% scoring set\r\n% this test may be extended and rescored\r\nsets = {\r\n  [10 3 2 1 6 5 4 8 7 9]\r\n  [10:-1:1]\r\n  [1:10]\r\n  [2:2:10 1:2:9]\r\n  [ 9 8 14 5 12 1 10 13 2 7 6 3 15 4 11]\r\n  [ 7 8 16 13 11 1 9 15 2 6 3 12 10 4 14 5]\r\n  [ 15 14 19 1 9 4 12 3 16 7 13 20 6 2 11 10 17 5 8 18]\r\n  [ 2 15 18 4 8 16 10 6 3 14 1 7 20 9 11 12 13 5 19 17 21]\r\n  [ 5 1 9 3 18 22 17 15 11 16 10 13 2 21 20 6 12 7 23 8 19 14 4]\r\n  [ 3 9 18 15 7 8 6 10 11 17 21 23 22 1 14 5 2 13 16 12 20 4 19]\r\n  [ 34 71 51 31 55 61 18 26 59 8 14 6 70 1 25 7 9 4 44 39 19 56 22 32 27 2 11 28 68 57 49 48 20 29 13 10 17 40 3 37 45 63 73 30 43 42 38 21 23 46 62 47 58 69 24 65 60 36 72 64 54 33 5 52 67 66 15 53 12 35 41 16 50]};\r\nfor k = 1:numel(sets)\r\n  x = sets{k};\r\n  queue = sort_pancakes(x);\r\n  for spatula = queue\r\n    x(1:spatula) = flip(x(1:spatula));\r\n  end\r\n  assert(issorted(x))\r\n  n(k) = numel(x);\r\n  score(k) = numel(queue);\r\nend\r\n%SetSolutionScore(sum(score));\r\n%fprintf('\\nTest %3d. %3d pancakes, %3d flips',[1:numel(sets); n; score]);","published":true,"deleted":false,"likes_count":4,"comments_count":5,"created_by":14358,"edited_by":223089,"edited_at":"2023-05-26T19:13:45.000Z","deleted_by":null,"deleted_at":null,"solvers_count":36,"test_suite_updated_at":"2023-05-26T19:13:45.000Z","rescore_all_solutions":false,"group_id":39,"created_at":"2015-08-06T15:12:33.000Z","updated_at":"2026-04-02T08:09:40.000Z","published_at":"2015-08-06T15:14:05.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a stack of pancakes by flipping them using spatula.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e pancakes with diameters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1:N\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort pancakes in increasing order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn a vector of places where spatula was inserted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMinimize number of flips, your score will depend on the number of flips in the last few tests.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReferences:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emath.illinois.edu\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pancake_sorting\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample (horizontal view):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Initial stack:  6 4 2 5 3 1,         (\\\",\\\" indicates position of spatula)\\nfirst flip:     1 3 5,2 4 6\\nsecond:         5 3 1 2 4,6\\n...             4 2 1 3,5 6\\n                3 1 2,4 5 6\\n                2 1,3 4 5 6\\nsorted!         1 2 3 4 5 6\\n\\npositions of spatula from the begining: 6 3 5 4 3 2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":94,"title":"Target sorting","description":"Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return the list sorted in descending order of the absolute value of the difference between |a(n)| and |t|.\n \nSo if a = [1 2 4 8 17] and t = 12, then the output b should be [1 2 4 17 8].\n","description_html":"\u003cp\u003eSort the given list of numbers \u003ctt\u003ea\u003c/tt\u003e according to how far away each element is from the target value \u003ctt\u003et\u003c/tt\u003e. The result should return the list sorted in descending order of the absolute value of the difference between \u003ctt\u003ea(n)\u003c/tt\u003e and \u003ctt\u003et\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eSo if a = [1 2 4 8 17] and t = 12, then the output b should be [1 2 4 17 8].\u003c/p\u003e","function_template":"function b = targetSort(a,t)\n  b = a;\nend","test_suite":"%%\na = [1 2 3 4];\nt = 0;\nb_correct = [4 3 2 1];\nassert(isequal(targetSort(a,t),b_correct))\n\n%%\na = -4:10;\nt = 3.6;\nb_correct = [-4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4];\nassert(isequal(targetSort(a,t),b_correct))\n\n%%\na = 12;\nt = pi;\nb_correct = 12;\nassert(isequal(targetSort(a,t),b_correct))\n\n%%\na = -100:-95;\nt = 100;\nb_correct = [-100 -99 -98 -97 -96 -95];\nassert(isequal(targetSort(a,t),b_correct))\n\n\n","published":true,"deleted":false,"likes_count":31,"comments_count":6,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4564,"test_suite_updated_at":"2012-01-18T01:00:30.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:30.000Z","updated_at":"2026-03-22T15:40:36.000Z","published_at":"2012-01-18T01:00:30.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort the given list of numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e according to how far away each element is from the target value\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003et\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The result should return the list sorted in descending order of the absolute value of the difference between\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003et\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo if a = [1 2 4 8 17] and t = 12, then the output b should be [1 2 4 17 8].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46582,"title":"Find jumping medalists","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 288px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 144px; transform-origin: 407.5px 144px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 377.308px 7.875px; transform-origin: 377.308px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eKey questions in number theory involve the distribution of prime numbers. For example, the Twin Prime Conjecture states that infinitely many twin primes, or two primes separated by 2, exist. This conjecture has not been proved, and progress is addressed in an interesting \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=vkMXdShDdtY\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003evideo from Numberphile\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.875px; transform-origin: 3.88333px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.983px 7.875px; transform-origin: 374.983px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem deals with the most common gap between primes up to a given number. John Conway dubbed this gap the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/JumpingChampion.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 56.8083px 7.875px; transform-origin: 56.8083px 7.875px; \"\u003ejumping champion\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 324.392px 7.875px; transform-origin: 324.392px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For numbers up to 20, the jumping champion is 2 because it occurs four times (between 3 and 5, 5 and 7, 11 and 13, and 17 and 19.) \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 293.708px 7.875px; transform-origin: 293.708px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTo me, the jumping champion is somewhat disappointing because 6 dominates until about 1.74\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAmCAYAAACMJGZuAAACdElEQVRoge2Z7ZGCMBCGnx7owAZsgAqowA6uAzqwBWuwBHuwBWugBe9HsucaIdnNHOLN5Z3J6MCSj4fN7gLQ1NTU1PQp2gFfwBh/c3Zj0s7Afu0JfooOwB24ALf4/0oAk+oYz+t2ec80t9eOAEiDORMgpB7WARPzEP+FvnjdQj0B1jE5PvIHvKiPzaoOGHjElME53kCAlUKULToRvM/b76rqCXdybkssaSQs5hSvHwjx54p9cZeZ8Xbx+JXneHUy9rmaZGJ6UhZYJ+YXILHmTh6YjDvxugVTOxnrTkgQm0hSuPxaYQ3Ktps5LxnvtnB+zyMmST9jYUyZ361g96PdwuAlWeoSCbQWWBJPlgJwp/rKeQ08gy1JtmWRwZ7gsheL8cxkjoXrrLC0V+W8QRZmgSDbrLSu0WhHzyMWWIEJKMsdtsLS8SMXk7RdybMlUVhgTQWbH4l3WYB5QIEdlo4zOQgj9m19xFZTnWMzywLMCwrssHTWtMKSjNnzms0ke2ovledGXb3Lut3PhTlgNaCgDlbuUURnV/EG8cprnOcQz6UAZW1T7OcQr/EUy0+aA1YLCvywSrFD9yewOh5eM7K8eFlLyc4lDUxXu15QUAcr51n6xrnizJra87w1akCBHdak7Lwxa3PpO+gpK1JtmQ3fotTVvXWYlhWWfiGXiyVWu7doLph76rBUNRW8xQMtxeaqymW9WmBbPRuuKkt5UAPMA0u8aykjHvgAr/LUUV5g1u0lyr3PEs/b7O1mTcFpBSZvOKV/a7UsQTx9U5o+vrxdsnBvDChdl36XS1vJI3esUG3/hmo/C/3bz0lNTU1NTU1NTU31+gYmIUCl6G4nbQAAAABJRU5ErkJggg==\" style=\"width: 37.5px; height: 19px;\" width=\"37.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 68.45px 7.875px; transform-origin: 68.45px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Therefore, I will coin another term: the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 56.025px 7.875px; transform-origin: 56.025px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ejumping medalists\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 266.817px 7.875px; transform-origin: 266.817px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, or the three most common gaps between primes up to a given number. For numbers up to 20, the gold, silver, and bronze jumping medals (i.e., first, second, and third place) go to 2, 4, and 1, respectively.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 336.983px 7.875px; transform-origin: 336.983px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that determines the jumping medalists as well as the maximum gap. Award the medals as in \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46576-award-medals-to-winners\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46576\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 206.925px 7.875px; transform-origin: 206.925px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and return an empty vector for any medal that cannot be awarded.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.875px; transform-origin: 0px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [J1,J2,J3,Jmax] = jumpingMedalists(n)\r\n  % J1, J2, J3 = most, second-most, and third-most common gaps, respectively\r\n  % Jmax = maximum gap \r\n  \r\n  J = f(n);\r\nend","test_suite":"%%\r\nn = 2;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nassert(isempty(J1) \u0026\u0026 isempty(J2) \u0026\u0026 isempty(J3) \u0026\u0026 isempty(Jmax))\r\n\r\n%%\r\nn = 5;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = [1 2];\r\nJmax_correct = 2;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isempty(J2) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 7;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = 1;\r\nJmax_correct = 2;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 11;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = [1 4];\r\nJmax_correct = 4;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 20;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = 4;\r\nJ3_correct = 1;\r\nJmax_correct = 4;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 100;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = [4 6];\r\nJmax_correct = 8;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 3141;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 4;\r\nJ3_correct = 2;\r\nJmax_correct = 34;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 50011;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 2;\r\nJ3_correct = 4;\r\nJmax_correct = 72;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 6021023;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 2;\r\nJmax_correct = 154;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 12221997;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 2;\r\nJmax_correct = 154;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 2e8;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 4;\r\nJmax_correct = 248;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-10T02:33:57.000Z","updated_at":"2026-01-20T11:05:32.000Z","published_at":"2020-09-10T04:15:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eKey questions in number theory involve the distribution of prime numbers. For example, the Twin Prime Conjecture states that infinitely many twin primes, or two primes separated by 2, exist. This conjecture has not been proved, and progress is addressed in an interesting \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=vkMXdShDdtY\\\"\u003e\u003cw:r\u003e\u003cw:t\u003evideo from Numberphile\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem deals with the most common gap between primes up to a given number. John Conway dubbed this gap the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/JumpingChampion.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ejumping champion\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. For numbers up to 20, the jumping champion is 2 because it occurs four times (between 3 and 5, 5 and 7, 11 and 13, and 17 and 19.) \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTo me, the jumping champion is somewhat disappointing because 6 dominates until about 1.74\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\times 10^{35}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Therefore, I will coin another term: the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ejumping medalists\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, or the three most common gaps between primes up to a given number. For numbers up to 20, the gold, silver, and bronze jumping medals (i.e., first, second, and third place) go to 2, 4, and 1, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that determines the jumping medalists as well as the maximum gap. Award the medals as in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46576-award-medals-to-winners\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46576\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and return an empty vector for any medal that cannot be awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":57988,"title":"Determine the minimum number of swaps to sort a vector","description":"Cody Problem 1401 asks us to sort a vector with the bubble sort algorithm and count the number of swaps needed. For example, to sort the vector [4 3 2 1] in increasing order, bubble sort requires six swaps. However, the vector can be sorted in only two swaps (4 \u0026 1 and 3 \u0026 2). \r\nWrite a function to determine the minimum number of swaps needed to sort a vector","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/1401\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration-line: underline; \"\u003eCody Problem 1401\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 308.433px 8px; transform-origin: 308.433px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asks us to sort a vector with the bubble sort algorithm and count the number of swaps needed. For example, to sort the vector [4 3 2 1] in increasing order, bubble sort requires six swaps. However, the vector can be sorted in only two swaps (4 \u0026amp; 1 and 3 \u0026amp; 2). \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 260.083px 8px; transform-origin: 260.083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine the minimum number of swaps needed to sort a vector\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = countSwaps(x)\r\n  y = length(find(x~=sort(x)));\r\nend","test_suite":"%%\r\nx = 1;\r\nassert(isequal(countSwaps(x),0))\r\n\r\n%%\r\nx = [2 1];\r\nassert(isequal(countSwaps(x),1))\r\n\r\n%%\r\nx = [3 1 2];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = 1:4;\r\nassert(isequal(countSwaps(x),0))\r\n\r\n%%\r\nx = [4 2 3 1];\r\nassert(isequal(countSwaps(x),1))\r\n\r\n%%\r\nx = [1 4 2 3];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = [5 2 1 4 3];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = [5 2 4 1 3];\r\nassert(isequal(countSwaps(x),3))\r\n\r\n%%\r\nx = [5 1 4 2 3];\r\nassert(isequal(countSwaps(x),4))\r\n\r\n%%\r\nx = [2 4 3 5 1 6];\r\nassert(isequal(countSwaps(x),3))\r\n\r\n%%\r\nx = [2 5 3 4 1 6];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = [10 8 7 6 2 3 1 5 4 9];\r\nassert(isequal(countSwaps(x),8))\r\n\r\n%%\r\nx = [8 1 10 6 3 2 4 5 7 9];\r\nassert(isequal(countSwaps(x),9))\r\n\r\n%%\r\nx = [12 14 13 18 9 2 7 5 16 10 8 4 11 6 3 1 17 15];\r\nassert(isequal(countSwaps(x),13))\r\n\r\n%%\r\nx = [87 79 11 21 140 69 109 126 24 162 10 142 91 7 174 90 157 124 42 147 84 4 96 34 143 95 2 116 101 56 88 134 160 177 85 65 180 35 81 139 179 128 20 137 141 93 151 156 135 28 98 163 45 33 13 37 61 59 19 43 17 166 82 14 123 54 60 120 127 149 80 168 146 30 171 169 119 108 136 75 117 78 18 15 164 175 104 89 118 155 165 145 133 125 58 112 150 5 132 130 38 105 57 97 121 110 26 29 3 115 36 6 70 178 12 74 50 122 39 153 158 83 167 27 66 40 172 138 176 86 152 8 92 129 51 114 159 76 16 113 44 48 99 131 63 62 71 144 72 68 25 67 53 49 170 173 1 100 103 52 9 64 47 94 55 46 111 161 77 31 32 107 73 154 106 41 22 148 23 102];\r\nassert(isequal(countSwaps(x),174))\r\n\r\n%%\r\nx = [169 154 170 136 92 138 108 172 144 94 33 21 23 22 8 146 53 93 145 153 95 31 25 104 90 27 58 71 13 64 65 5 74 137 30 117 125 143 85 51 68 89 157 48 176 11 115 79 91 178 52 39 98 120 107 131 82 18 158 174 142 173 45 50 38 7 105 165 84 97 101 10 81 67 111 109 46 160 139 155 47 114 40 126 110 66 179 20 41 69 86 166 49 4 128 167 124 87 57 56 17 24 132 43 3 149 103 123 100 135 60 121 34 80 2 63 156 118 147 159 28 72 55 16 168 96 127 73 175 164 141 140 76 36 133 19 152 6 113 129 163 9 1 44 29 134 150 177 130 99 12 35 37 112 119 14 32 70 161 180 106 15 42 148 102 88 171 162 116 75 122 54 61 62 78 83 59 151 26 77];\r\nassert(isequal(countSwaps(x),173))\r\n\r\n%%\r\nx = 1:10000;\r\nr = randperm(10000);\r\nn = randi(1000);\r\ni1 = r(1:2:2*n-1);\r\ni2 = r(2:2:2*n);\r\na = x(i1);\r\nx(i1) = x(i2);\r\nx(i2) = a;\r\nassert(isequal(countSwaps(x),n))\r\n\r\n%%\r\nfiletext = fileread('countSwaps.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') || contains(filetext, 'regexp'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2023-04-15T15:26:41.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-04-15T15:26:35.000Z","updated_at":"2023-04-15T15:26:41.000Z","published_at":"2023-04-15T15:26:41.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/1401\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 1401\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003e asks us to sort a vector with the bubble sort algorithm and count the number of swaps needed. For example, to sort the vector [4 3 2 1] in increasing order, bubble sort requires six swaps. However, the vector can be sorted in only two swaps (4 \u0026amp; 1 and 3 \u0026amp; 2). \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine the minimum number of swaps needed to sort a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1056,"title":"Partial sorting algorithm","description":"Return the top k elements of an input vector. A comparison function compareFcn(m,n) is provided to compare individual elements of the vector. The function returns true is element m should be ranked higher than element n. e.g.\r\n\r\n  partial_sort([4 3 2 1], 2, @(m,n) m \u003e n)\r\n  \r\n  ans =\r\n  \r\n       4     3\r\n\r\n  partial_sort([4 3 2 1], 2, @(m,n) m \u003c n)\r\n  \r\n  ans =\r\n  \r\n       1     2\r\n\r\nAll elements in the input vector will be unique.\r\n\r\nSolutions will be ranked on the total number of times comparison functions are called, over all the test cases.","description_html":"\u003cp\u003eReturn the top k elements of an input vector. A comparison function compareFcn(m,n) is provided to compare individual elements of the vector. The function returns true is element m should be ranked higher than element n. e.g.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003epartial_sort([4 3 2 1], 2, @(m,n) m \u003e n)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eans =\r\n\u003c/pre\u003e\u003cpre\u003e       4     3\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003epartial_sort([4 3 2 1], 2, @(m,n) m \u0026lt; n)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eans =\r\n\u003c/pre\u003e\u003cpre\u003e       1     2\u003c/pre\u003e\u003cp\u003eAll elements in the input vector will be unique.\u003c/p\u003e\u003cp\u003eSolutions will be ranked on the total number of times comparison functions are called, over all the test cases.\u003c/p\u003e","function_template":"function x = partial_sort(y,k,compareFcn)\r\n  ySorted = sort(y,'descend');\r\n  x = ySorted(1:k)\r\nend","test_suite":"%%\r\nfeval(@assignin,'caller','score',250);\r\n%% number of comparisons needed\r\nglobal totalNCompare\r\ntotalNCompare = 0;\r\n%% simple highest ranking\r\ncompareFcn = @(x,y) x(1) \u003e y(1);\r\ny = [6 3 1 9 5];\r\nx_correct = [9 6 5];\r\nprofile on\r\nx = partial_sort(y,3,compareFcn);\r\nassert(isequal(x,x_correct))\r\nprofile off\r\nstats = profile('info');\r\nfound = false;\r\nfor i = 1:length(stats.FunctionTable)\r\n    functionName = stats.FunctionTable(i).FunctionName;\r\n    numCalls = stats.FunctionTable(i).NumCalls;\r\n    if ~isempty(strfind(functionName,'@(x,y)x(1)\u003ey(1)'))\r\n        found = true;\r\n        break\r\n    end    \r\nend\r\nassert(found)\r\nglobal totalNCompare\r\ntotalNCompare = totalNCompare + numCalls;\r\n\r\n%% shortest strings\r\ncompareFcn = @(x,y) length(x) \u003c length(y);\r\ny = {'a','bc','def','ghij','klmno','pqrstu'};\r\nx_correct = {'a','bc','def','ghij'};\r\nprofile on\r\nx = partial_sort(y,4,compareFcn);\r\nassert(isequal(x,x_correct))\r\nprofile off\r\nstats = profile('info');\r\nfound = false;\r\nfor i = 1:length(stats.FunctionTable)\r\n    functionName = stats.FunctionTable(i).FunctionName;\r\n    numCalls = stats.FunctionTable(i).NumCalls;\r\n    if ~isempty(strfind(functionName,'@(x,y)length(x)\u003clength(y)'))\r\n        found = true;\r\n        break\r\n    end    \r\nend\r\nassert(found)\r\nglobal totalNCompare\r\ntotalNCompare = totalNCompare + numCalls;\r\n\r\n%% order by division\r\ncompareFcn = @(x,y) mod(x(1),y(1)) == 0;\r\ny = [1 2 3 4 5 6 10 12 15 20 30 60];\r\nx_correct = [60 30 12 20];\r\nprofile on\r\nx = partial_sort(y,4,compareFcn);\r\nassert(isequal(sort(x),sort(x_correct)))\r\nprofile off\r\nstats = profile('info');\r\nfound = false;\r\nfor i = 1:length(stats.FunctionTable)\r\n    functionName = stats.FunctionTable(i).FunctionName;\r\n    numCalls = stats.FunctionTable(i).NumCalls;\r\n    if ~isempty(strfind(functionName,'@(x,y)mod(x(1),y(1))==0'))\r\n        found = true;\r\n        break\r\n    end    \r\nend\r\nassert(found)\r\nglobal totalNCompare\r\ntotalNCompare = totalNCompare + numCalls;\r\n\r\n%%\r\nglobal totalNCompare\r\nfeval(@assignin,'caller','score',totalNCompare);\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":450,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2012-11-25T18:26:40.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-11-24T22:40:03.000Z","updated_at":"2012-11-25T18:26:40.000Z","published_at":"2012-11-24T22:55:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the top k elements of an input vector. A comparison function compareFcn(m,n) is provided to compare individual elements of the vector. The function returns true is element m should be ranked higher than element n. e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[partial_sort([4 3 2 1], 2, @(m,n) m \u003e n)\\n\\nans =\\n\\n       4     3\\n\\npartial_sort([4 3 2 1], 2, @(m,n) m \u003c n)\\n\\nans =\\n\\n       1     2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAll elements in the input vector will be unique.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolutions will be ranked on the total number of times comparison functions are called, over all the test cases.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1876,"title":"GJam: 2013 China Event: Name Sorting","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2933486/dashboard#s=p2 GJam 2013 China Moist\u003e. The problem is Codified by making the input a cell array of names.\r\n\r\nThe Challenge involves a serial card sorting machine that places card (i+1) in its best position, 1 thru i, if the name on card (i+1) is lexicographically greater than the name on card (i). The machine continues thru the end of the deck. The machine then restarts at card 1 until the order is correct. The output to return is the number of card insertions. The character values follow ascii codes with Space \u003c A:Z \u003c a:z. A shorter name is less than an extended name (Ab\u003cAbe)\r\n\r\n*Input:* names  ( cell array of names )\r\n\r\n*Output:* Insertions  (count of card insertions required)\r\n\r\n*Competition Summary:*  Best Time 6 minutes, 793/1049 correct\r\n\r\n*Example:*\r\n\r\nnames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\r\n\r\nClearly takes 3 card insertions. Start (SRJD)  moves [(RSJD) (JRSD) (DJRS)]","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2933486/dashboard#s=p2\"\u003eGJam 2013 China Moist\u003c/a\u003e. The problem is Codified by making the input a cell array of names.\u003c/p\u003e\u003cp\u003eThe Challenge involves a serial card sorting machine that places card (i+1) in its best position, 1 thru i, if the name on card (i+1) is lexicographically greater than the name on card (i). The machine continues thru the end of the deck. The machine then restarts at card 1 until the order is correct. The output to return is the number of card insertions. The character values follow ascii codes with Space \u0026lt; A:Z \u0026lt; a:z. A shorter name is less than an extended name (Ab\u0026lt;Abe)\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e names  ( cell array of names )\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Insertions  (count of card insertions required)\u003c/p\u003e\u003cp\u003e\u003cb\u003eCompetition Summary:\u003c/b\u003e  Best Time 6 minutes, 793/1049 correct\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003enames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\u003c/p\u003e\u003cp\u003eClearly takes 3 card insertions. Start (SRJD)  moves [(RSJD) (JRSD) (DJRS)]\u003c/p\u003e","function_template":"function cost=sort_cost(names)\r\n% names is a cell array\r\n  cost=0;\r\nend","test_suite":"%%\r\ntic\r\nnames={'Daniil Barantsev' 'Maria Balaba' 'Krisztina Barta' 'Patrice Archetto' 'Petra Arponen' 'Giovanna Almeida Leto' 'Tanith Belbin' 'Melania Albea' 'Lubov Bakirova' 'Mao Asada' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Fedor Andreev' 'Alessia Aureli' };\r\nexp=1;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jeremy Allen' 'Vazgen Azrojan' 'Zabato Bebe' 'An Ni' 'Vladimir Belomoin' 'Julia Beloglazova' 'Irina Babenko' 'Vitali Baranov' 'Vadim Akolzin' 'Mai Asada' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Babkin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mary Grace Baldo' 'Dmitri Antoni' 'Andrew Bassi' 'Tanith Belbin' 'Emilia Ahsan' 'Adrian Alvarado' 'Michael Bahoric' 'Vitali Babkin' 'Charlotte Belair' 'Annie Bellemare' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Baranov' 'William Beier' 'Charlotte Belair' 'Andrei Bekh' 'Letizia Alessandrini' 'Oksana Baiul' 'Felicia Beck' 'Margaret Albia' 'Johanna Allik' 'Christiane Berger' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vadim Akolzin' 'Dmitri Antoni' 'Petra Arponen' 'Felicia Beck' 'Letizia Alessandrini' 'Marina Anissina' 'Alisa Allapach' 'An Yang' 'Tobias Bayer' 'Imola Antal' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Stuart Beckingham' 'Ryan Arnold' 'Vazgen Azrojan' 'Oksana Baiul' 'Laurent Alvarez' 'Vitali Baranov' 'Tayfun Anar' 'Andrei Bekh' 'Evan Bates' 'Ilia Averbukh' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alibel Alegre' 'Alla Beknazarova' 'Andrew Bassi' 'Megan Allely' 'Elladj Balde' 'Tatiana Basova' 'Olga Akimova' 'Marta Andrade' 'Mao Asada' 'Becky Bereswill' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Laurent Alvarez' 'Mary Grace Baldo' 'Julia Abolina' 'Krisztina Barta' 'Marina Aganina' 'Becky Bereswill' 'Olga Akimova' 'Vazgen Azrojan' 'Elena Berezhnaya' 'Yann Abback' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mao Asada' 'Vitali Baranov' 'Rinata Araslanova' 'Margaret Albia' 'Giovanna Almeida Leto' 'Hanna Asadchaya' 'Andrew Bassi' 'Marina Anissina' 'Tayfun Anar' 'Birce Atabey' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\r\nexp=3;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Marina Anissina' 'Valentina Anselmi' 'Spencer Barnes' 'Ivan Bariev' 'Miki Ando' 'Alexandra Baurina' 'Maria Balaba' 'Andrew Bassi' 'Imola Antal' 'Anastasia Belova' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Felicia Beck' 'William Beier' 'John Baldwin' 'Julia Beloglazova' 'Margaret Albia' 'Colette Appel' 'Maria Balaba' 'Olga Akimova' 'Daniil Barantsev' 'Sara Beikircher' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Petra Arponen' 'Christina Beier' 'Alexei Beletski' 'Tayfun Anar' 'Saulius Ambrulevicius' 'Patrice Archetto' 'Rinata Araslanova' 'Sofia Bardakov' 'Alisa Allapach' 'Nadine Ahmed' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'Kevin Alves' 'Adrian Alvarado' 'Florent Amodio' 'Andrei Bekh' 'Alisa Agafonova' 'Gabor Balint' 'Giovanna Almeida Leto' 'Letizia Alessandrini' 'Oksana Baiul' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alisa Agafonova' 'Kevin Alves' 'Laurent Alvarez' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Miki Ando' 'Gloria Agogliati' 'An Yang' 'Felicia Beck' 'Tobias Bayer' 'Vitali Babkin' 'Andrei Bekh' 'Ivan Bariev' 'Melania Albea' 'Florent Amodio' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alla Beknazarova' 'Erica Archambault' 'Fedor Andreev' 'Felicia Beck' 'Irina Babenko' 'Krisztian Andraska' 'Mai Asada' 'Marina Aganina' 'Melania Albea' 'Vadim Akolzin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Michael Bahoric' 'Evan Bates' 'Olga Akimova' 'Emilia Ahsan' 'Vitali Baranov' 'Erica Archambault' 'Charlotte Belair' 'Alexandra Baurina' 'Tayfun Anar' 'Vera Bazarova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Vera Bazarova' 'Spencer Barnes' 'Annie Bellemare' 'Krisztina Barta' 'Olga Akimova' 'Vadim Akolzin' 'Veronika Benesova' 'Adrian Alvarado' 'Alexander Abt' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Gloria Agogliati' 'Elladj Balde' 'Colette Appel' 'An Yang' };\r\nexp=4;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Hanna Asadchaya' 'Ian Beharry' 'Julia Beloglazova' 'Michael Bahoric' 'Shizuka Arakawa' 'Spencer Barnes' 'Vera Bazarova' 'Vladimir Belomoin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Emilia Ahsan' 'Alisa Allapach' 'Felicia Beck' 'Engin Ali Artan' 'Valentina Anselmi' 'Alexander Abt' 'Jill Bakker' 'Jody Annandale' 'Nina Bates' 'Irina Babenko' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Evan Bates' 'Sergei Baranov' 'Rie Arikawa' 'Florent Amodio' 'Nadine Ahmed' 'Alla Beknazarova' 'Sofia Bardakov' 'Alexander Abt' 'Birce Atabey' 'Charlotte Belair' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexander Abt' 'Charlotte Belair' 'Kristen Avis' 'Nadine Ahmed' 'Tanith Belbin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Bogdan Berezenko' 'Veronika Benesova' 'Sarah Abitbol' 'Christiane Berger' 'Tayfun Anar' 'Giovanna Almeida Leto' 'Michael Bahoric' 'John Baldwin' 'Elladj Balde' 'Jill Bakker' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Elvis Stojko' 'Evgeni Plushenko' 'KristiYamaguchi' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztian Andraska' 'Katarina Babalova' 'Annie Bellemare' 'Melania Albea' 'Petra Arponen' 'Irina Babenko' 'Johanna Allik' 'Sara Beikircher' 'Charlotte Belair' 'Miki Ando' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Oksana Baiul' 'MichelleKwan' };\r\nexp=1;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexei Beletski' 'Joelle Bastiaans' 'Alisa Allapach' 'Alisa Agafonova' 'Vladimir Belomoin' 'Letizia Alessandrini' 'Krisztina Barta' 'Becky Bereswill' 'Benjamin Agosto' 'Michael Bahoric' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Margaret Albia' 'Johanna Allik' 'Daniil Barantsev' 'Camilla Andersen' 'Andrei Bekh' 'Alla Beknazarova' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alisa Allapach' 'Andrew Bassi' 'Daniil Barantsev' 'Hanna Asadchaya' 'Imola Antal' 'Jeremy Abbott' 'Jill Bakker' 'Marina Anissina' 'Rinata Araslanova' 'Shizuka Arakawa' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Tayfun Anar' 'Rinata Araslanova' 'Nina Bates' 'Michael Bahoric' 'Julia Abolina' 'Jeremy Abbott' 'Ian Beharry' 'Engin Ali Artan' 'Colette Appel' 'Birce Atabey' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Melania Albea' 'Nadine Ahmed' 'Miki Ando' 'Alexei Beletski' 'Florent Amodio' 'Jake Bennett' 'Camilla Andersen' 'Jeremy Allen' 'Rie Arikawa' 'Kristen Avis' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Laurent Alvarez' 'Katarina Babalova' 'Shizuka Arakawa' 'Elladj Balde' 'Daniil Barantsev' 'Gabor Balint' 'Adrian Alvarado' 'Andrew Bassi' 'Anastasia Belova' 'Krisztina Barta' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexandra Baurina' 'Jake Bennett' 'Marina Aganina' 'Marina Anissina' 'Vadim Akolzin' 'William Beier' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Adrian Alvarado' 'Alisa Agafonova' 'Charlotte Belair' 'Evan Bates' 'Gloria Agogliati' 'Pascale Bergeron' 'Sarah Abitbol' 'Stuart Beckingham' 'Tayfun Anar' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Miguel Ballesteros' 'Julia Beloglazova' 'Eve Bentley' 'Spencer Barnes' 'Jeremy Allen' 'Megan Allely' 'Katarina Babalova' 'Birce Atabey' 'Jeremy Abbott' 'Vladimir Belomoin' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Engin Ali Artan' 'Christiane Berger' 'Petra Arponen' 'Veronika Benesova' 'Vera Bazarova' 'Andrew Bassi' 'Anastasia Belova' 'Kristen Avis' 'Margaret Albia' 'Alexei Beletski' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexandra Baurina' 'Gabor Balint' 'Emili Arm' 'Elena Berezhnaya' 'Tanith Belbin' 'Dmitri Antoni' 'Adrian Alvarado' 'Melania Albea' 'Andrew Bassi' 'Engin Ali Artan' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Gabor Balint' 'Imola Antal' 'Mao Asada' 'Jeremy Allen' 'Hanna Asadchaya' 'Charlotte Belair' 'Evan Bates' 'Alexei Beletski' 'William Beier' 'Michael Bahoric' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Giovanna Almeida Leto' 'Gabor Balint' 'Krisztian Andraska' 'Benjamin Agosto' 'Evan Bates' 'Maria Balaba' 'Marta Andrade' 'Ian Beharry' 'Tatiana Basova' 'Rie Arikawa' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexandra Baurina' 'Imola Antal' 'Evan Bates' 'Felicia Beck' 'Ian Beharry' 'Bogdan Berezenko' 'Becky Bereswill' 'Michael Bahoric' 'Tayfun Anar' 'Stuart Beckingham' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Charlotte Belair' 'An Yang' 'Paolo Bacchini' 'Olga Akimova' 'Vitali Baranov' 'Spencer Barnes' 'Valentina Anselmi' 'Annie Bellemare' 'Mary Grace Baldo' 'Ivan Bariev' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Katarina Babalova' 'Bogdan Berezenko' 'Marta Andrade' 'Vadim Akolzin' 'Spencer Barnes' 'Michael Bahoric' 'Krisztian Andraska' 'Alibel Alegre' 'Emilia Ahsan' 'Beril Bektas' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Birce Atabey' 'Anastasia Belova' 'Tobias Bayer' 'Kristen Avis' 'Rima Beliy' 'Andrew Bassi' 'Letizia Alessandrini' 'Alexei Beletski' 'Julia Abolina' 'Evan Bates' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztian Andraska' 'Sarah Abitbol' 'Kristen Avis' 'Tayfun Anar' 'Vadim Akolzin' 'Letizia Alessandrini' 'Margaret Albia' 'Joelle Bastiaans' 'Pascale Bergeron' 'Elladj Balde' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Hanna Asadchaya' 'Johanna Allik' 'Nadine Ahmed' 'Sarah Abitbol' 'Elladj Balde' 'Jake Bennett' 'Saulius Ambrulevicius' 'Laurent Alvarez' 'Beril Bektas' 'Krisztina Barta' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Spencer Barnes' 'Shizuka Arakawa' 'Sara Beikircher' 'Ryan Arnold' 'Pascale Bergeron' 'Hanna Asadchaya' 'Bogdan Berezenko' 'Annie Bellemare' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Patrice Archetto' 'Vera Bazarova' 'Miki Ando' 'Beril Bektas' 'Rie Arikawa' 'Adrian Alvarado' 'Rima Beliy' 'Fedor Andreev' 'Megan Allely' 'Nina Bates' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexei Beletski' 'Letizia Alessandrini' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Sofia Bardakov' 'Julia Abolina' 'Tayfun Anar' 'Miguel Ballesteros' 'Daniil Barantsev' 'Elladj Balde' 'John Baldwin' 'Alisa Agafonova' 'Benjamin Agosto' 'Vera Bazarova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Paolo Bacchini' 'Patrice Archetto' 'Anastasia Belova' 'Emili Arm' 'Ian Beharry' 'Evan Bates' 'Kevin Alves' 'Gabor Balint' 'Johanna Allik' 'Spencer Barnes' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Sergei Baranov' 'Mai Asada' 'Gabor Balint' 'Vazgen Azrojan' 'Christiane Berger' 'Alisa Allapach' 'Paolo Bacchini' 'An Yang' 'Lubov Bakirova' 'Stuart Beckingham' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Laurent Alvarez' 'Dmitri Antoni' 'Annie Bellemare' 'Veronika Benesova' 'Ivan Bariev' 'Emili Arm' 'An Yang' 'Colette Appel' 'Vitali Baranov' 'Fedor Andreev' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Birce Atabey' 'Camilla Andersen' 'Charlotte Belair' 'Daniil Barantsev' 'Krisztian Andraska' 'Mai Asada' 'Marina Aganina' 'Mary Grace Baldo' 'Shizuka Arakawa' 'Joelle Bastiaans' };\r\nexp=1;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Babkin' 'Colette Appel' 'Saulius Ambrulevicius' 'Fedor Andreev' 'Sofia Bardakov' 'Daniil Barantsev' 'Kevin Alves' 'Birce Atabey' 'Becky Bereswill' 'Letizia Alessandrini' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Ilia Averbukh' 'Jake Bennett' 'Julia Beloglazova' 'Petra Arponen' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Pascale Bergeron' 'Engin Ali Artan' 'Zabato Bebe' 'Shizuka Arakawa' 'Vazgen Azrojan' 'Elena Berezhnaya' 'Alisa Agafonova' 'Alisa Allapach' 'Laurent Alvarez' 'Marta Andrade' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztina Barta' 'Marta Andrade' 'Andrei Bekh' 'Stuart Beckingham' 'Pascale Bergeron' 'Sara Beikircher' 'Ivan Bariev' 'Gabor Balint' 'Dmitri Antoni' 'Mao Asada' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Tanith Belbin' 'Marta Andrade' 'Zabato Bebe' 'Emilia Ahsan' 'Johanna Allik' 'Christina Beier' 'Alexander Abt' 'Shizuka Arakawa' 'Eve Bentley' 'Sara Beikircher' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Julia Abolina' 'Felicia Beck' 'Vadim Akolzin' 'Letizia Alessandrini' 'Gloria Agogliati' 'Olga Akimova' 'Christina Beier' 'Tayfun Anar' 'Adrian Alvarado' 'Elena Berezhnaya' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alessia Aureli' 'Mao Asada' 'Mai Asada' 'Nadine Ahmed' 'Jeremy Abbott' 'Gabor Balint' 'Marina Anissina' 'Birce Atabey' 'Miguel Ballesteros' 'Beril Bektas' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Birce Atabey' 'Emilia Ahsan' 'Felicia Beck' 'Jeremy Allen' 'Oksana Baiul' 'Alisa Agafonova' 'Florent Amodio' 'Joelle Bastiaans' 'Michael Bahoric' 'Saulius Ambrulevicius' };\r\nexp=4;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Benjamin Agosto' 'Vitali Babkin' 'Vitali Baranov' 'Bogdan Berezenko' 'Mai Asada' 'Beril Bektas' 'Hanna Asadchaya' 'Camilla Andersen' 'An Yang' 'Rie Arikawa' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Tobias Bayer' 'Joelle Bastiaans' 'Alibel Alegre' 'Annie Bellemare' 'Alessia Aureli' 'Emili Arm' 'Florent Amodio' 'Julia Beloglazova' 'Birce Atabey' 'Sofia Bardakov' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Giovanna Almeida Leto' 'Alexandra Baurina' 'Marta Andrade' 'Julia Beloglazova' 'Felicia Beck' 'Johanna Allik' 'Rima Beliy' 'Gloria Agogliati' 'Rie Arikawa' 'Eve Bentley' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Katarina Babalova' 'Elena Berezhnaya' };\r\nexp=2;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Adrian Alvarado' 'Rinata Araslanova' 'Vitali Baranov' 'Yann Abback' 'Emili Arm' 'Marina Anissina' 'Engin Ali Artan' 'Jeremy Abbott' 'Alessia Aureli' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'John Baldwin' 'Laurent Alvarez' 'Erica Archambault' 'Emilia Ahsan' 'Johanna Allik' 'Hanna Asadchaya' 'Alexandra Baurina' 'Vitali Babkin' 'Rinata Araslanova' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Fedor Andreev' 'Shizuka Arakawa' 'Oksana Baiul' 'Kevin Alves' 'Jody Annandale' 'Christiane Berger' 'Sofia Bardakov' 'Emilia Ahsan' 'Ryan Arnold' 'Tayfun Anar' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Sergei Baranov' 'Saulius Ambrulevicius' 'Michael Bahoric' 'Evan Bates' 'An Ni' 'Tobias Bayer' 'Christina Beier' 'Maria Balaba' 'Emili Arm' 'Jody Annandale' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexei Beletski' 'Florent Amodio' 'Marina Anissina' 'Margaret Albia' 'Michael Bahoric' 'Miki Ando' 'Gloria Agogliati' 'Evan Bates' 'Becky Bereswill' 'Alexandra Baurina' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'Emilia Ahsan' 'Ian Beharry' 'Paolo Bacchini' 'Maria Balaba' 'Giovanna Almeida Leto' 'An Yang' 'Michael Bahoric' 'Fedor Andreev' 'Alisa Agafonova' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'Vazgen Azrojan' 'Sara Beikircher' 'Eve Bentley' 'Alla Beknazarova' 'Pascale Bergeron' 'Tatiana Basova' 'Elena Berezhnaya' 'Oksana Baiul' 'Zabato Bebe' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alessia Aureli' 'Alexei Beletski' 'Alisa Agafonova' 'Anastasia Belova' 'Colette Appel' 'Kevin Alves' 'Veronika Benesova' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Tayfun Anar' 'Saulius Ambrulevicius' 'Miguel Ballesteros' 'Maria Balaba' 'Mai Asada' 'Lubov Bakirova' 'Edward Alton' 'Birce Atabey' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Miki Ando' 'Benjamin Agosto' 'Jeremy Allen' 'Adrian Alvarado' 'Alisa Allapach' 'Sofia Bardakov' 'Joelle Bastiaans' 'Margaret Albia' 'Erica Archambault' 'Kevin Alves' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Julia Beloglazova' 'Marina Aganina' 'Alisa Agafonova' 'Alexei Beletski' 'Camilla Andersen' 'Giovanna Almeida Leto' 'Colette Appel' 'Nina Bates' 'Tanith Belbin' 'Vitali Baranov' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mao Asada' 'Dmitri Antoni' 'Marina Aganina' 'Annie Bellemare' 'Zabato Bebe' 'Andrew Bassi' 'Valentina Anselmi' 'Michael Bahoric' 'Jake Bennett' 'Mary Grace Baldo' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Shizuka Arakawa' 'Stuart Beckingham' 'Jeremy Abbott' 'Nadine Ahmed' 'Olga Akimova' 'Vadim Akolzin' 'Becky Bereswill' 'Charlotte Belair' 'Gabor Balint' 'Margaret Albia' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Beril Bektas' 'Stuart Beckingham' 'Jill Bakker' 'Daniil Barantsev' 'Sarah Abitbol' 'Benjamin Agosto' 'Andrei Bekh' 'Julia Beloglazova' 'Alibel Alegre' 'Nina Bates' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Charlotte Belair' 'Gloria Agogliati' 'Miguel Ballesteros' 'Hanna Asadchaya' 'Ilia Averbukh' 'Katarina Babalova' 'Tobias Bayer' 'Marta Andrade' 'Petra Arponen' 'Paolo Bacchini' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Evan Bates' 'Imola Antal' 'Eve Bentley' 'Miguel Ballesteros' 'Emili Arm' 'Rie Arikawa' 'Patrice Archetto' 'Julia Abolina' 'Jeremy Allen' 'Edward Alton' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mary Grace Baldo' 'William Beier' 'Mai Asada' 'Vazgen Azrojan' 'Marina Anissina' 'Krisztian Andraska' 'Ivan Bariev' 'Tayfun Anar' 'Spencer Barnes' 'Maria Balaba' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Lubov Bakirova' 'Alexei Beletski' 'Mai Asada' 'William Beier' 'Shizuka Arakawa' 'Alla Beknazarova' 'Alessia Aureli' 'Miguel Ballesteros' 'Rinata Araslanova' 'Alexander Abt' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Baranov' 'Patrice Archetto' 'Charlotte Belair' 'Maria Balaba' 'Marina Anissina' 'Oksana Baiul' 'Alla Beknazarova' 'Shizuka Arakawa' 'Andrei Bekh' 'Zabato Bebe' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztina Barta' 'Yann Abback' 'Johanna Allik' 'Andrew Bassi' 'Irina Babenko' 'Fedor Andreev' 'Emilia Ahsan' 'Mary Grace Baldo' 'Tanith Belbin' 'Spencer Barnes' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Shizuka Arakawa' 'Tanith Belbin' 'Hanna Asadchaya' 'Mai Asada' 'Krisztian Andraska' 'Gabor Balint' 'Sofia Bardakov' 'Gloria Agogliati' 'Valentina Anselmi' 'Alisa Agafonova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Ilia Averbukh' 'Andrei Bekh' 'Imola Antal' 'Mao Asada' 'Colette Appel' 'Emili Arm' 'Irina Babenko' 'Sergei Baranov' 'Elena Berezhnaya' 'Julia Beloglazova' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Ryan Arnold' 'Rie Arikawa' 'Nina Bates' 'Katarina Babalova' 'Jeremy Allen' 'Charlotte Belair' 'Alexei Beletski' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vladimir Belomoin' 'Melania Albea' 'Florent Amodio' 'An Ni' 'John Baldwin' 'Jeremy Abbott' 'Zabato Bebe' 'Olga Akimova' 'Petra Arponen' 'Jake Bennett' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alisa Agafonova' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Elladj Balde' 'Charlotte Belair' 'Bogdan Berezenko' 'Julia Abolina' 'Alexandra Baurina' 'Sergei Baranov' 'Megan Allely' 'Marta Andrade' 'Anastasia Belova' 'Ivan Bariev' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Gloria Agogliati' 'Alessia Aureli' 'Julia Abolina' 'Charlotte Belair' 'Andrew Bassi' 'Gabor Balint' 'Vladimir Belomoin' 'Tanith Belbin' 'Patrice Archetto' 'Shizuka Arakawa' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mary Grace Baldo' 'Florent Amodio' 'Vitali Babkin' 'Engin Ali Artan' 'Olga Akimova' 'Maria Balaba' 'Jeremy Allen' 'Margaret Albia' 'Ivan Bariev' 'Miguel Ballesteros' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Andrew Bassi' 'Tobias Bayer' 'Hanna Asadchaya' 'Krisztian Andraska' 'Vladimir Belomoin' 'Erica Archambault' 'Ilia Averbukh' 'Ivan Bariev' 'Margaret Albia' 'Michael Bahoric' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Hanna Asadchaya' 'Gloria Agogliati' 'Camilla Andersen' 'Veronika Benesova' 'Alisa Allapach' 'Charlotte Belair' 'Emili Arm' 'Jake Bennett' 'An Yang' 'Krisztina Barta' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Patrice Archetto' 'Christina Beier' 'Ivan Bariev' 'Rima Beliy' 'Alisa Allapach' 'Paolo Bacchini' 'William Beier' 'An Ni' 'Spencer Barnes' 'Vera Bazarova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\ntoc\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-16T04:35:47.000Z","updated_at":"2025-11-21T08:36:28.000Z","published_at":"2013-09-16T04:51:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2933486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 China Moist\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. The problem is Codified by making the input a cell array of names.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Challenge involves a serial card sorting machine that places card (i+1) in its best position, 1 thru i, if the name on card (i+1) is lexicographically greater than the name on card (i). The machine continues thru the end of the deck. The machine then restarts at card 1 until the order is correct. The output to return is the number of card insertions. The character values follow ascii codes with Space \u0026lt; A:Z \u0026lt; a:z. A shorter name is less than an extended name (Ab\u0026lt;Abe)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e names ( cell array of names )\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Insertions (count of card insertions required)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCompetition Summary:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Time 6 minutes, 793/1049 correct\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003enames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eClearly takes 3 card insertions. Start (SRJD) moves [(RSJD) (JRSD) (DJRS)]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42497,"title":"Pancake sorting","description":"Sort a stack of pancakes by flipping them using spatula.\r\n\r\n* There are _N_ pancakes with diameters _1:N_.\r\n* Spatula can be inserted anywhere in the stack and used to flip all the pancakes above.\r\n* Sort pancakes in increasing order.\r\n* Return a vector of places where spatula was inserted.\r\n* References: \u003chttp://www.math.illinois.edu/~dwest/openp/pancake.html math.illinois.edu\u003e, \u003chttps://en.wikipedia.org/wiki/Pancake_sorting wikipedia\u003e.\r\n\r\n\r\nExample (horizontal view):\r\n\r\n  Initial stack:  6 4 2 5 3 1,         (\",\" indicates position of spatula)\r\n  first flip:     1 3 5,2 4 6\r\n  second:         5 3 1 2 4,6\r\n  ...             4 2 1 3,5 6\r\n                  3 1 2,4 5 6\r\n                  2 1,3 4 5 6\r\n  sorted!         1 2 3 4 5 6\r\n  \r\n  positions of spatula from the begining: 6 3 5 4 3 2","description_html":"\u003cp\u003eSort a stack of pancakes by flipping them using spatula.\u003c/p\u003e\u003cul\u003e\u003cli\u003eThere are \u003ci\u003eN\u003c/i\u003e pancakes with diameters \u003ci\u003e1:N\u003c/i\u003e.\u003c/li\u003e\u003cli\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/li\u003e\u003cli\u003eSort pancakes in increasing order.\u003c/li\u003e\u003cli\u003eReturn a vector of places where spatula was inserted.\u003c/li\u003e\u003cli\u003eReferences: \u003ca href = \"http://www.math.illinois.edu/~dwest/openp/pancake.html\"\u003emath.illinois.edu\u003c/a\u003e, \u003ca href = \"https://en.wikipedia.org/wiki/Pancake_sorting\"\u003ewikipedia\u003c/a\u003e.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExample (horizontal view):\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eInitial stack:  6 4 2 5 3 1,         (\",\" indicates position of spatula)\r\nfirst flip:     1 3 5,2 4 6\r\nsecond:         5 3 1 2 4,6\r\n...             4 2 1 3,5 6\r\n                3 1 2,4 5 6\r\n                2 1,3 4 5 6\r\nsorted!         1 2 3 4 5 6\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003epositions of spatula from the begining: 6 3 5 4 3 2\r\n\u003c/pre\u003e","function_template":"function y = sort_pancakes(stack)\r\n  y = 1:numel(stack);\r\nend","test_suite":"%%\r\nx = 1:5;\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = [6 4 2 5 3 1];\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(12);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(13);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nfor k = 1:20\r\n  x = randperm(k);\r\n  for spatula = sort_pancakes(x)\r\n    x(1:spatula) = flip(x(1:spatula));\r\n  end\r\n  assert(issorted(x))\r\nend","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":14358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":39,"created_at":"2015-08-06T13:42:18.000Z","updated_at":"2026-04-02T08:21:14.000Z","published_at":"2015-08-06T14:03:01.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a stack of pancakes by flipping them using spatula.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e pancakes with diameters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1:N\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort pancakes in increasing order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn a vector of places where spatula was inserted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReferences:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.math.illinois.edu/~dwest/openp/pancake.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emath.illinois.edu\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pancake_sorting\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample (horizontal view):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Initial stack:  6 4 2 5 3 1,         (\\\",\\\" indicates position of spatula)\\nfirst flip:     1 3 5,2 4 6\\nsecond:         5 3 1 2 4,6\\n...             4 2 1 3,5 6\\n                3 1 2,4 5 6\\n                2 1,3 4 5 6\\nsorted!         1 2 3 4 5 6\\n\\npositions of spatula from the begining: 6 3 5 4 3 2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44952,"title":"Find MPG of Lightest Cars","description":"The file cars.mat contains a table named cars with variables Model, MPG, Horsepower, Weight, and Acceleration for several classic cars.\r\nLoad the MAT-file. Given an integer N, calculate the output variable mpg.\r\nOutput mpg should contain the MPG of the top N lightest cars (by Weight) in a column vector.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 103.65px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 51.825px; transform-origin: 406.5px 51.825px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42.55px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 21.275px; text-align: left; transform-origin: 383.5px 21.275px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 22.8917px 7.81667px; transform-origin: 22.8917px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe file\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 31.2667px 7.81667px; transform-origin: 31.2667px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 31.2667px 8.375px; transform-origin: 31.2667px 8.375px; \"\u003ecars.mat\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 77.6083px 7.81667px; transform-origin: 77.6083px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e contains a table named\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.6333px 7.81667px; transform-origin: 15.6333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 15.6333px 8.375px; transform-origin: 15.6333px 8.375px; \"\u003ecars\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 45.225px 7.81667px; transform-origin: 45.225px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with variables\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 19.5417px 7.81667px; transform-origin: 19.5417px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 19.5417px 8.375px; transform-origin: 19.5417px 8.375px; \"\u003eModel\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003eMPG\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 39.0833px 7.81667px; transform-origin: 39.0833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 39.0833px 8.375px; transform-origin: 39.0833px 8.375px; \"\u003eHorsepower\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 23.45px 7.81667px; transform-origin: 23.45px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 23.45px 8.375px; transform-origin: 23.45px 8.375px; \"\u003eWeight\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 16.1917px 7.81667px; transform-origin: 16.1917px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46.9px 7.81667px; transform-origin: 46.9px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 46.9px 8.375px; transform-origin: 46.9px 8.375px; \"\u003eAcceleration\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.65px 7.81667px; transform-origin: 11.65px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for several classic cars.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21.55px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.775px; text-align: left; transform-origin: 383.5px 10.775px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 111.667px 7.81667px; transform-origin: 111.667px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eLoad the MAT-file. Given an integer\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.90833px 7.81667px; transform-origin: 3.90833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.90833px 8.375px; transform-origin: 3.90833px 8.375px; \"\u003eN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 94.3583px 7.81667px; transform-origin: 94.3583px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, calculate the output variable\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003empg\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21.55px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.775px; text-align: left; transform-origin: 383.5px 10.775px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 21.775px 7.81667px; transform-origin: 21.775px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOutput\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003empg\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 61.4167px 7.81667px; transform-origin: 61.4167px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e should contain the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003eMPG\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.3833px 7.81667px; transform-origin: 32.3833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of the top\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.90833px 7.81667px; transform-origin: 3.90833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.90833px 8.375px; transform-origin: 3.90833px 8.375px; \"\u003eN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 54.1583px 7.81667px; transform-origin: 54.1583px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e lightest cars (by\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 23.45px 7.81667px; transform-origin: 23.45px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 23.45px 8.375px; transform-origin: 23.45px 8.375px; \"\u003eWeight\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 64.7667px 7.81667px; transform-origin: 64.7667px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) in a column vector.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function mpg = sort_cars(N)\r\n mpg = N;\r\n\r\nend","test_suite":"%%\r\nfiletext = fileread('sort_cars.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp');\r\nassert(~illegal)\r\n\r\n\r\n%%\r\nN = 5\r\ntry % 2023a (and all prior versions?)\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdemos', 'carbig.mat'));\r\ncatch % 2023b\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdata', 'carbig.mat'));\r\nend\r\nModel = strtrim(string(Model));\r\ncars = table(Model, MPG, Horsepower, Weight, Acceleration);\r\nsave cars.mat cars\r\nassert(isequal(sort_cars(N),[35; 31; 39.1; 35.1; 31]));\r\n%%\r\nN = 6\r\ntry % 2023a (and all prior versions?)\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdemos', 'carsmall.mat'));\r\ncatch % 2023b\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdata', 'carsmall.mat'));\r\nend\r\nModel = strtrim(string(Model));\r\ncars = table(Model, MPG, Horsepower, Weight, Acceleration);\r\nsave cars.mat cars\r\nassert(isequal(sort_cars(N),[33; 29.5; 26; 29; 38; 32]));\r\n","published":true,"deleted":false,"likes_count":77,"comments_count":51,"created_by":162851,"edited_by":223089,"edited_at":"2024-06-28T16:23:33.000Z","deleted_by":null,"deleted_at":null,"solvers_count":7553,"test_suite_updated_at":"2024-06-28T16:23:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-08-19T17:55:52.000Z","updated_at":"2026-04-03T12:20:01.000Z","published_at":"2019-08-29T18:06:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe file\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecars.mat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e contains a table named\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecars\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with variables\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eModel\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMPG\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHorsepower\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWeight\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAcceleration\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e for several classic cars.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLoad the MAT-file. Given an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, calculate the output variable\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003empg\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003empg\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e should contain the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMPG\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of the top\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e lightest cars (by\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWeight\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) in a column vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":42816,"title":"Sorting integers by their digits (Level 4)","description":"This is the next step up from \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42815-sorting-integers-by-their-digits-level-3 Problem 42815\u003e.\r\n\r\nGiven a vector, v, of complex numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nOnce all real digits have been used for sorting, it should continue with the imaginary part, which are further down the order.\r\n\r\nExample:\r\n\r\nv = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\r\n\r\nw = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\r\n\r\nAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\r\n\r\nNegative numbers take precedence over positive numbers.\r\n\r\nImaginary numbers should be treated as if they had a leading zero, because they have a zero real part.","description_html":"\u003cp\u003eThis is the next step up from \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42815-sorting-integers-by-their-digits-level-3\"\u003eProblem 42815\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eGiven a vector, v, of complex numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eOnce all real digits have been used for sorting, it should continue with the imaginary part, which are further down the order.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\u003c/p\u003e\u003cp\u003ew = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/p\u003e\u003cp\u003eNegative numbers take precedence over positive numbers.\u003c/p\u003e\u003cp\u003eImaginary numbers should be treated as if they had a leading zero, because they have a zero real part.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\r\nw_correct = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-246 -24680 2468 246 24 -2 24680 -24 -2468 2];\r\nw_correct = [-2 2 -24 24 -246 246 -2468 2468 -24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-0.22222 0.22 0.222 0.2 0.2222];\r\nw_correct = [0.2 0.22 0.222 0.2222 -0.22222];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-6.28 4-12i 4.01+12i 4-13i 4+13i 4+14.9i 0-75i 0+391i 4-148i];\r\nw_correct = [0+391i 0-75i 4-12i 4-13i 4+13i 4-148i 4+14.9i 4.01+12i -6.28];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":3,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":45,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-20T20:15:04.000Z","updated_at":"2026-03-12T21:55:39.000Z","published_at":"2016-04-20T20:15:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the next step up from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42815-sorting-integers-by-their-digits-level-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 42815\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of complex numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOnce all real digits have been used for sorting, it should continue with the imaginary part, which are further down the order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNegative numbers take precedence over positive numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImaginary numbers should be treated as if they had a leading zero, because they have a zero real part.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":795,"title":"Joining Ranges","description":"You are given a n-by-2 matrix. Each row represents a numeric range, e.g.\r\n\r\n  x = [0 5; 10 3; 20 15; 16 19; 25 25]\r\n  \r\ncontains ranges [0 5], [10 3], [20 15], [16 19], and [25 25]. Note that the first column does not always contain the smaller number. Join all overlapping ranges and return the sorted (both columns and all rows must be sorted) matrix of joined ranges\r\n\r\n  y = [0 10; 15 20; 25 25]\r\n\r\ni.e. ranges [0 5] and [10 3] are combined to [0 10], range [16 19] is completely overlapped by [15 20] and [25 25] is kept because it is a separate range.","description_html":"\u003cp\u003eYou are given a n-by-2 matrix. Each row represents a numeric range, e.g.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = [0 5; 10 3; 20 15; 16 19; 25 25]\r\n\u003c/pre\u003e\u003cp\u003econtains ranges [0 5], [10 3], [20 15], [16 19], and [25 25]. Note that the first column does not always contain the smaller number. Join all overlapping ranges and return the sorted (both columns and all rows must be sorted) matrix of joined ranges\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ey = [0 10; 15 20; 25 25]\r\n\u003c/pre\u003e\u003cp\u003ei.e. ranges [0 5] and [10 3] are combined to [0 10], range [16 19] is completely overlapped by [15 20] and [25 25] is kept because it is a separate range.\u003c/p\u003e","function_template":"function y = joinRanges(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [0 5; 10 3; 20 15; 16 19; 25 25];\r\ny_correct = [0 10;15 20;25 25];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [-10 -5; 0 -8; -1 5]; \r\ny_correct = [-10 5];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [-50 0; 0 50; 100 50; -50 -100]; \r\ny_correct = [-100 100];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n\r\n%%\r\nx = [99 51; -49 -1; -51 -99; 1 49]; \r\ny_correct = [-99 -51;-49 -1;1 49;51 99];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n\r\n%%\r\nx = [-inf inf]; \r\ny_correct = x;\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [0 -42; -inf -10; inf 42]; \r\ny_correct = [-Inf 0;42 Inf];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [36.154 63.178; 12.007 -5.156; -0.519 17.651]; \r\ny_correct = [-5.156 17.651;36.154 63.178];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nassert(isempty(strfind(evalc('type joinRanges'), 'regexp')));","published":true,"deleted":false,"likes_count":9,"comments_count":3,"created_by":4976,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":399,"test_suite_updated_at":"2013-10-20T11:57:08.000Z","rescore_all_solutions":false,"group_id":12,"created_at":"2012-06-27T16:04:34.000Z","updated_at":"2026-02-17T06:56:17.000Z","published_at":"2012-06-27T16:10:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are given a n-by-2 matrix. Each row represents a numeric range, e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = [0 5; 10 3; 20 15; 16 19; 25 25]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003econtains ranges [0 5], [10 3], [20 15], [16 19], and [25 25]. Note that the first column does not always contain the smaller number. Join all overlapping ranges and return the sorted (both columns and all rows must be sorted) matrix of joined ranges\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[y = [0 10; 15 20; 25 25]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ei.e. ranges [0 5] and [10 3] are combined to [0 10], range [16 19] is completely overlapped by [15 20] and [25 25] is kept because it is a separate range.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":38,"title":"Return a list sorted by number of occurrences","description":"Given a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x.\r\nTies are resolved by a sort from lowest to highest.\r\nSo if\r\n x = [1 2 2 2 3 3 7 7 93]\r\nthen\r\n y = [2 3 7 1 93]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 172.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 86.4333px; transform-origin: 407px 86.4333px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 318.5px 8px; transform-origin: 318.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 156.5px 8px; transform-origin: 156.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTies are resolved by a sort from lowest to highest.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSo if\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e x = [1 2 2 2 3 3 7 7 93]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ethen\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 68px 8.5px; tab-size: 4; transform-origin: 68px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e y = [2 3 7 1 93]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = popularity(x)\r\n  y = x\r\nend","test_suite":"%%\r\nx = [1 2 2 2 3 3 7 7 93]\r\ny_correct = [2 3 7 1 93];\r\nassert(isequal(popularity(x),y_correct))\r\n\r\n%%\r\nx = [-1 19 20 -1 -1 87 19 34 19 -1 21 87 20 10 20 34 19 -1];\r\ny_correct = [-1 19 20 34 87 10 21];\r\nassert(isequal(popularity(x),y_correct))\r\n\r\n%%\r\nx = repelem(1:5,1:5);\r\ny_correct = flip(1:5);\r\nassert(isequal(popularity(x),y_correct))","published":true,"deleted":false,"likes_count":19,"comments_count":2,"created_by":1,"edited_by":223089,"edited_at":"2022-10-08T16:12:27.000Z","deleted_by":null,"deleted_at":null,"solvers_count":2890,"test_suite_updated_at":"2022-10-08T16:12:27.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:22.000Z","updated_at":"2026-03-06T19:31:36.000Z","published_at":"2012-01-18T01:00:22.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTies are resolved by a sort from lowest to highest.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo if\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 2 2 2 3 3 7 7 93]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethen\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ y = [2 3 7 1 93]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":70,"title":"Alphabetize by last name","description":"Given a list of names in a cell array, sort the list by the last name. So if \n\n list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'}; \n\nthen the output is \n\n alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}\n","description_html":"\u003cp\u003eGiven a list of names in a cell array, sort the list by the last name. So if\u003c/p\u003e\u003cpre\u003e list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'}; \u003c/pre\u003e\u003cp\u003ethen the output is\u003c/p\u003e\u003cpre\u003e alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}\u003c/pre\u003e","function_template":"function alpha_list = alphabetize(list)\n  alpha_list = list;\nend","test_suite":"%%\nlist = {'Barney Google','Snuffy Smith','Dagwood Bumstead'};\nalpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}\nassert(isequal(alphabetize(list),alpha_list))\n\n%%\nlist = {'Harry Truman'\n    'Dwight Eisenhower'\n    'John F. Kennedy'\n    'Lyndon Johnson'\n    'Richard Nixon'\n    'Gerald Ford'\n    'Cleve Moler'\n    'Ronald Reagan'\n    'George Bush'\n    'Bill Clinton'\n    'George Bush'\n    'Barack Obama'};\nalpha_list = {'George Bush'\n    'George Bush'\n    'Bill Clinton'\n    'Dwight Eisenhower'\n    'Gerald Ford'\n    'Lyndon Johnson'\n    'John F. Kennedy'\n     'Cleve Moler'\n    'Richard Nixon'\n    'Barack Obama'\n    'Ronald Reagan'\n    'Harry Truman'}\nassert(isequal(alphabetize(list),alpha_list))","published":true,"deleted":false,"likes_count":17,"comments_count":8,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2342,"test_suite_updated_at":"2012-01-18T01:00:27.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:27.000Z","updated_at":"2026-03-10T16:48:02.000Z","published_at":"2012-01-18T01:00:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of names in a cell array, sort the list by the last name. So if\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'};]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethen the output is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1740,"title":"Find number patterns in rows of a matrix...","description":"So I think this may be a hard one, may be it was only hard for me!  So here is what it is, I will give a matrix, with some number of rows by 5 columns, to make it simpler I will not repeat any number in a *single row*, so all numbers in a *single rows* are unique. So you need to find up to 2, 3 or 4 numbers that are found in a *single row* that repeat in *other rows* and the amount of times they repeat in a given matrix. To make it a little better, you only need to display the rows/numbers that repeat at lease twice or more. Examples are the best way to show what to do:\r\n  \r\n          %p is the given matrix\r\n          p = [1 2 3 4 5;\r\n               2 3 4 5 1;\r\n               3 4 6 7 8;\r\n               1 2 4 3 5;\r\n               4 6 3 2 1];\r\n          %v is the amount of elements per row that are being checked to see if they repeat in another row\r\n          v = 4;\r\n        %Output:\r\n        out =\r\n        \r\n             1     2     3     4     4\r\n             1     2     3     5     3\r\n             1     2     4     5     3\r\n             1     3     4     5     3\r\n             2     3     4     5     3\r\n      %So the first to the fourth column are the four number that were found to repeat in rows of matrix p (any and all combination that can appear in the rows of the matrix p). The fifth column is the amount of times the that particular set of matrix out(?,1:4) appear in matrix p. for for row one in matrix out, 1,2,3 and 4 in any combination appear 4 time in the rows of matrix p.\r\n      \r\n      So more examples...\r\n      \r\n      p = [1 2 3 4 9;\r\n           2 3 1 4 8]\r\n      v = 4;\r\n      \r\n      out =\r\n           1     2     3     4     2\r\n    %so any combination of 1,2,3 and 4 appear 2 times in matrix p\r\n    \r\n    and another:\r\n    \r\n    p = [1 2 3 4 9;\r\n         2 3 1 4 8;\r\n         3 4 2 7 1]\r\n    v = 3;\r\n      \r\n    out =\r\n         1     2     3     3\r\n         1     2     4     3\r\n         1     3     4     3\r\n         2     3     4     3\r\n    %so this uses any combo of 3 values, so in this case out(?,1:3) are the number combos that can be found in matrix p, and the out(?,4) is the amount of times that those combos are found\r\n    \r\n    last example:\r\n    \r\n    p = [1 2 3 4 9;\r\n         2 3 1 4 8]\r\n    v = 2;\r\n    \r\n    out =\r\n         1     2     2\r\n         1     3     2\r\n         1     4     2\r\n         2     3     2\r\n         2     4     2\r\n         3     4     2\r\n    %so in this case only combos of out(?,1:2) are found and out(?,3) is the amounts of times that combo of out(?,1:2) is found in matrix p. so row four of matrix out (so out(4,:)...) shows that the combo of 2 and 3 are found 2 times in matrix p.\r\n\r\nNOTE: only display any row number combos that occur at least 2 times or more!\r\n\r\nI hope I gave enough instructions and explanation, if not please let me know and I will add to it! Thanks and good luck!","description_html":"\u003cp\u003eSo I think this may be a hard one, may be it was only hard for me!  So here is what it is, I will give a matrix, with some number of rows by 5 columns, to make it simpler I will not repeat any number in a \u003cb\u003esingle row\u003c/b\u003e, so all numbers in a \u003cb\u003esingle rows\u003c/b\u003e are unique. So you need to find up to 2, 3 or 4 numbers that are found in a \u003cb\u003esingle row\u003c/b\u003e that repeat in \u003cb\u003eother rows\u003c/b\u003e and the amount of times they repeat in a given matrix. To make it a little better, you only need to display the rows/numbers that repeat at lease twice or more. Examples are the best way to show what to do:\u003c/p\u003e\u003cpre\u003e          %p is the given matrix\r\n          p = [1 2 3 4 5;\r\n               2 3 4 5 1;\r\n               3 4 6 7 8;\r\n               1 2 4 3 5;\r\n               4 6 3 2 1];\r\n          %v is the amount of elements per row that are being checked to see if they repeat in another row\r\n          v = 4;\r\n        %Output:\r\n        out =\u003c/pre\u003e\u003cpre\u003e             1     2     3     4     4\r\n             1     2     3     5     3\r\n             1     2     4     5     3\r\n             1     3     4     5     3\r\n             2     3     4     5     3\r\n      %So the first to the fourth column are the four number that were found to repeat in rows of matrix p (any and all combination that can appear in the rows of the matrix p). The fifth column is the amount of times the that particular set of matrix out(?,1:4) appear in matrix p. for for row one in matrix out, 1,2,3 and 4 in any combination appear 4 time in the rows of matrix p.\u003c/pre\u003e\u003cpre\u003e      So more examples...\u003c/pre\u003e\u003cpre\u003e      p = [1 2 3 4 9;\r\n           2 3 1 4 8]\r\n      v = 4;\u003c/pre\u003e\u003cpre\u003e      out =\r\n           1     2     3     4     2\r\n    %so any combination of 1,2,3 and 4 appear 2 times in matrix p\u003c/pre\u003e\u003cpre\u003e    and another:\u003c/pre\u003e\u003cpre\u003e    p = [1 2 3 4 9;\r\n         2 3 1 4 8;\r\n         3 4 2 7 1]\r\n    v = 3;\u003c/pre\u003e\u003cpre\u003e    out =\r\n         1     2     3     3\r\n         1     2     4     3\r\n         1     3     4     3\r\n         2     3     4     3\r\n    %so this uses any combo of 3 values, so in this case out(?,1:3) are the number combos that can be found in matrix p, and the out(?,4) is the amount of times that those combos are found\u003c/pre\u003e\u003cpre\u003e    last example:\u003c/pre\u003e\u003cpre\u003e    p = [1 2 3 4 9;\r\n         2 3 1 4 8]\r\n    v = 2;\u003c/pre\u003e\u003cpre\u003e    out =\r\n         1     2     2\r\n         1     3     2\r\n         1     4     2\r\n         2     3     2\r\n         2     4     2\r\n         3     4     2\r\n    %so in this case only combos of out(?,1:2) are found and out(?,3) is the amounts of times that combo of out(?,1:2) is found in matrix p. so row four of matrix out (so out(4,:)...) shows that the combo of 2 and 3 are found 2 times in matrix p.\u003c/pre\u003e\u003cp\u003eNOTE: only display any row number combos that occur at least 2 times or more!\u003c/p\u003e\u003cp\u003eI hope I gave enough instructions and explanation, if not please let me know and I will add to it! Thanks and good luck!\u003c/p\u003e","function_template":"function out = findRowPattern(p,v)\r\n  out = [p v];\r\nend","test_suite":"%%\r\np = [1 2 3 4 5;\r\n     2 3 4 5 1;\r\n     3 4 6 7 8;\r\n     1 2 4 3 5;\r\n     4 6 3 2 1];\r\nv = 4;\r\nout = [1 2 3 4 4;\r\n       1 2 3 5 3;\r\n       1 2 4 5 3;\r\n       1 3 4 5 3;\r\n       2 3 4 5 3]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [1 2 3 4 9;\r\n     2 3 1 4 8]\r\nv = 4;\r\nout = [1 2 3 4 2]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [1 2 3 4 9;\r\n     2 3 1 4 8;\r\n     3 4 2 7 1]\r\nv = 3;\r\nout = [1 2 3 3;\r\n       1 2 4 3;\r\n       1 3 4 3;\r\n       2 3 4 3]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [1 2 3 4 9;\r\n     2 3 1 4 8]\r\nv = 2;\r\nout = [1 2 2;\r\n       1 3 2;\r\n       1 4 2;\r\n       2 3 2;\r\n       2 4 2;\r\n       3 4 2]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [15 23 68 49 88;\r\n     69 58 78 21 35;\r\n     10 23 21 35 88;\r\n     99 58 63 24 10;\r\n     64 28 14 33 58;\r\n     85 69 21 45 55;\r\n     99 24 76 49 33;\r\n     89 69 33 98 21;\r\n     99 10 21 55 58;\r\n     35 68 69 44 21;\r\n     21 69 35 46 33];\r\nv = 3;\r\nout = [21 35 69 3;\r\n     10 58 99 2;\r\n     21 33 69 2]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [15 23 68 49 88;\r\n     69 58 78 21 35;\r\n     10 23 21 35 88;\r\n     99 58 63 24 10;\r\n     64 28 14 33 58;\r\n     85 69 21 45 55;\r\n     99 24 76 49 33;\r\n     89 69 33 98 21;\r\n     99 10 21 55 58;\r\n     35 68 69 44 21;\r\n     21 69 35 46 33];\r\nv = 2;\r\n\r\nout = [21    69     5;\r\n       21    35     4;\r\n       35    69     3;\r\n       10    21     2;\r\n       10    58     2;\r\n       10    99     2;\r\n       21    33     2;\r\n       21    55     2;\r\n       21    58     2;\r\n       23    88     2;\r\n       24    99     2;\r\n       33    69     2;\r\n       58    99     2]\r\nassert(isequal(findRowPattern(p,v),out))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":"2013-07-23T17:11:41.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-23T16:51:20.000Z","updated_at":"2025-06-22T11:25:55.000Z","published_at":"2013-07-23T17:11:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo I think this may be a hard one, may be it was only hard for me! So here is what it is, I will give a matrix, with some number of rows by 5 columns, to make it simpler I will not repeat any number in a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle row\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, so all numbers in a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle rows\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are unique. So you need to find up to 2, 3 or 4 numbers that are found in a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle row\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that repeat in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eother rows\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and the amount of times they repeat in a given matrix. To make it a little better, you only need to display the rows/numbers that repeat at lease twice or more. Examples are the best way to show what to do:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[          %p is the given matrix\\n          p = [1 2 3 4 5;\\n               2 3 4 5 1;\\n               3 4 6 7 8;\\n               1 2 4 3 5;\\n               4 6 3 2 1];\\n          %v is the amount of elements per row that are being checked to see if they repeat in another row\\n          v = 4;\\n        %Output:\\n        out =\\n\\n             1     2     3     4     4\\n             1     2     3     5     3\\n             1     2     4     5     3\\n             1     3     4     5     3\\n             2     3     4     5     3\\n      %So the first to the fourth column are the four number that were found to repeat in rows of matrix p (any and all combination that can appear in the rows of the matrix p). The fifth column is the amount of times the that particular set of matrix out(?,1:4) appear in matrix p. for for row one in matrix out, 1,2,3 and 4 in any combination appear 4 time in the rows of matrix p.\\n\\n      So more examples...\\n\\n      p = [1 2 3 4 9;\\n           2 3 1 4 8]\\n      v = 4;\\n\\n      out =\\n           1     2     3     4     2\\n    %so any combination of 1,2,3 and 4 appear 2 times in matrix p\\n\\n    and another:\\n\\n    p = [1 2 3 4 9;\\n         2 3 1 4 8;\\n         3 4 2 7 1]\\n    v = 3;\\n\\n    out =\\n         1     2     3     3\\n         1     2     4     3\\n         1     3     4     3\\n         2     3     4     3\\n    %so this uses any combo of 3 values, so in this case out(?,1:3) are the number combos that can be found in matrix p, and the out(?,4) is the amount of times that those combos are found\\n\\n    last example:\\n\\n    p = [1 2 3 4 9;\\n         2 3 1 4 8]\\n    v = 2;\\n\\n    out =\\n         1     2     2\\n         1     3     2\\n         1     4     2\\n         2     3     2\\n         2     4     2\\n         3     4     2\\n    %so in this case only combos of out(?,1:2) are found and out(?,3) is the amounts of times that combo of out(?,1:2) is found in matrix p. so row four of matrix out (so out(4,:)...) shows that the combo of 2 and 3 are found 2 times in matrix p.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNOTE: only display any row number combos that occur at least 2 times or more!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eI hope I gave enough instructions and explanation, if not please let me know and I will add to it! Thanks and good luck!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":42715,"title":" Throw common elements of two vector arrays in sorted manner","description":"\r\nThrow common elements as output in sorted manner (acending order) of two given input vector arrays","description_html":"\u003cp\u003eThrow common elements as output in sorted manner (acending order) of two given input vector arrays\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nA = [1 2 3 4 5 6 7 8];\r\nB = [4 5 6 6 7 0 12 34];\r\ny_correct = [7 6 5 4];\r\nassert(isequal(your_fcn_name(A,B),y_correct))\r\n\r\n%%\r\nA = [1 2 3 4 5 6 71 8];\r\nB = [4 5 6 6 7 0 12 34];\r\ny_correct = [6 5 4];\r\nassert(isequal(your_fcn_name(A,B),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46868,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":74,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-01-15T10:10:48.000Z","updated_at":"2026-02-28T08:11:04.000Z","published_at":"2016-01-15T10:17:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThrow common elements as output in sorted manner (acending order) of two given input vector arrays\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":56568,"title":"Remove Duplicates","description":"Remove duplicates from the vector of integers and display in sorted order","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eRemove duplicates from the vector of integers and display in sorted order\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 3 4 1 2 4 2345 252  23];\r\ny_correct = [1 2 3 4 23 252 2345];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":2797263,"edited_by":2797263,"edited_at":"2022-11-09T21:46:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-11-09T21:44:10.000Z","updated_at":"2026-03-09T18:42:41.000Z","published_at":"2022-11-09T21:46:56.000Z","restored_at":"2022-11-10T15:14:33.000Z","restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRemove duplicates from the vector of integers and display in sorted order\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":55005,"title":"Sort vector by number of prime factors of each element ","description":"Sort a given array based on how many prime factors each term has. Sort from least to greatest and output original values. \r\nEx:\r\nInput: [17, 23432432, 442, 12, 16, 71]\r\nOut: [17, 71, 442, 12, 16, 23432432]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 111px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 55.5px; transform-origin: 407px 55.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort a given array based on how many prime factors each term has. Sort from least to greatest and output original values. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 9.5px 8px; transform-origin: 9.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEx:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 119.5px 8px; transform-origin: 119.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInput: [17, 23432432, 442, 12, 16, 71]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 115.5px 8px; transform-origin: 115.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOut: [17, 71, 442, 12, 16, 23432432]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function sorted = Prime_Factor_Sort(x)\r\n  sorted = x\r\nend","test_suite":"%%\r\nx = [664   992   944   350   193   920   289   551   919    90];\r\ny_correct = [193   919   289   551   664   350    90   944   920   992];\r\nassert(isequal(Prime_Factor_Sort(x),y_correct))\r\n\r\n%%\r\nx = [17, 23432432, 442, 12, 16, 71];\r\ny_correct = [17, 71, 442, 12, 16, 23432432];\r\nassert(isequal(Prime_Factor_Sort(x),y_correct))\r\n\r\n\r\n%%\r\nx = primes(25);\r\nx = x(randperm(numel(x)));\r\nassert(isequal(Prime_Factor_Sort(x),x))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2453230,"edited_by":223089,"edited_at":"2022-08-20T10:55:57.000Z","deleted_by":null,"deleted_at":null,"solvers_count":24,"test_suite_updated_at":"2022-08-20T10:55:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-07-12T19:07:47.000Z","updated_at":"2026-03-05T10:29:22.000Z","published_at":"2022-07-12T19:07:47.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a given array based on how many prime factors each term has. Sort from least to greatest and output original values. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEx:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput: [17, 23432432, 442, 12, 16, 71]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOut: [17, 71, 442, 12, 16, 23432432]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":58593,"title":" findPositiveEvenNumbers ","description":"Write a MATLAB function findPositiveEvenNumbers that takes an array of integers as input and returns a new array containing only the positive even numbers from the input array. The output array should be sorted in ascending order.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 21px; transform-origin: 407.5px 21px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a MATLAB function findPositiveEvenNumbers that takes an array of integers as input and returns a new array containing only the positive even numbers from the input array. The output array should be sorted in ascending order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(inputArray)\r\n    y = inputArray;\r\nend","test_suite":"%%\r\nx = [3, -2, 8, 0, -5, 12, -10, 7];\r\ny_correct = [8, 12];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":10,"comments_count":0,"created_by":3495653,"edited_by":3495653,"edited_at":"2023-07-18T13:35:17.000Z","deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-07-17T23:19:52.000Z","updated_at":"2026-02-27T14:12:15.000Z","published_at":"2023-07-17T23:19:52.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a MATLAB function findPositiveEvenNumbers that takes an array of integers as input and returns a new array containing only the positive even numbers from the input array. The output array should be sorted in ascending order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46108,"title":"Sort in descending order.","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 20.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 331.5px 10.4px; transform-origin: 331.5px 10.4px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 308.5px 10.4px; text-align: left; transform-origin: 308.5px 10.4px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven a vector x. Sort the vector in descending order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function x_sort = sort_descending(x)\r\nx_sort = - sort(-x);\r\nend","test_suite":"%%\r\nx = [-3 1 8 2];\r\ny_correct = [8 2 1 -3];\r\nassert(isequal(sort_descending(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":505754,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":111,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-08-05T20:45:01.000Z","updated_at":"2026-03-16T01:33:03.000Z","published_at":"2020-08-05T20:45:01.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector x. Sort the vector in descending order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46893,"title":"Sort accordingly","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 20.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.4px; transform-origin: 407px 10.4px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.4px; text-align: left; transform-origin: 384px 10.4px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven x, output is a magic(x) matrix that has a sorted columns accorind to its last column\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = ?\r\nend","test_suite":"%%\r\nx = 3;\r\ny_correct = [4     9     2\r\n     8     1     6\r\n     3     5     7];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 4;\r\ny_correct = [ 4    14    15     1\r\n     5    11    10     8\r\n     9     7     6    12\r\n    16     2     3    13];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":54,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-17T20:34:27.000Z","updated_at":"2026-03-02T09:13:46.000Z","published_at":"2020-10-17T20:34:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven x, output is a magic(x) matrix that has a sorted columns accorind to its last column\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":61030,"title":"The MATLAB Treasure Hunt – Decode the First Clue Hidden in a Jumbled Sequence of Numbers","description":"You discover an ancient parchment inside the college archives. It contains a jumbled sequence of numbers that seems meaningless — until you notice faint MATLAB-like symbols next to it!\r\nYour first task is to decode the clue by arranging the numbers in ascending order. The smallest number might mark the beginning of the treasure trail.\r\nGiven a row vector a, return another vector b containing all elements of a sorted in increasing order.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 61.5px; transform-origin: 408px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou discover an ancient parchment inside the college archives. It contains a jumbled sequence of numbers that seems meaningless — until you notice faint MATLAB-like symbols next to it!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYour first task is to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003edecode the clue\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e by arranging the numbers in \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eascending order\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The smallest number might mark the beginning of the treasure trail.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a row vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ea\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, return another vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eb\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e containing all elements of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ea\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e sorted in increasing order.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = firstClue(a)\r\n  y = x;\r\nend","test_suite":"%%\r\na = [42 7 13 5 19];\r\ny_correct = [5 7 13 19 42];\r\nassert(isequal(firstClue(a),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":110,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-21T09:21:20.000Z","updated_at":"2026-03-26T03:52:14.000Z","published_at":"2025-10-21T09:21:20.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou discover an ancient parchment inside the college archives. It contains a jumbled sequence of numbers that seems meaningless — until you notice faint MATLAB-like symbols next to it!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour first task is to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edecode the clue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e by arranging the numbers in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eascending order\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The smallest number might mark the beginning of the treasure trail.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a row vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return another vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eb\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e containing all elements of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e sorted in increasing order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43079,"title":"Check if two matrices are permutations of each other","description":"Your function should return true for the elements of one matrix is the permutation of the other matrix:\r\n\r\n  x = [1 2 3; 4 5 6; 7 8 9]\r\n  y = [3 5 6; 7 1 2; 4 9 8]\r\n\r\nor \r\n\r\n  x = [1 2; 3 4; 5 6]\r\n  y = [1 2 3; 4 5 6]\r\n\r\nPlease note that the matrices can have different shapes or sizes!","description_html":"\u003cp\u003eYour function should return true for the elements of one matrix is the permutation of the other matrix:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = [1 2 3; 4 5 6; 7 8 9]\r\ny = [3 5 6; 7 1 2; 4 9 8]\r\n\u003c/pre\u003e\u003cp\u003eor\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = [1 2; 3 4; 5 6]\r\ny = [1 2 3; 4 5 6]\r\n\u003c/pre\u003e\u003cp\u003ePlease note that the matrices can have different shapes or sizes!\u003c/p\u003e","function_template":"function isPerm = isPermute(x,y)\r\n    isPerm = true;\r\nend","test_suite":"%%\r\nx = [1 2 3; 4 5 6; 7 8 9]\r\ny = [3 5 6; 7 1 2; 4 9 8]\r\nisPerm = true;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = [1 2; 4 5; 7 8];\r\ny = x';\r\nisPerm = true;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = 1:50;\r\ny = randperm(50);\r\nisPerm = true;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = 2:51;\r\ny = randperm(50);\r\nisPerm = false;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n%%\r\nx = [1 2 3; 4 5 6; 7 8 9]\r\ny = [3 5; 7 1; 4 9]\r\nisPerm = false;\r\nassert(isequal(isPermute(x,y),isPerm))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":25354,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":57,"test_suite_updated_at":"2016-10-05T21:51:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:47:13.000Z","updated_at":"2026-03-02T09:07:38.000Z","published_at":"2016-10-05T21:47:13.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour function should return true for the elements of one matrix is the permutation of the other matrix:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = [1 2 3; 4 5 6; 7 8 9]\\ny = [3 5 6; 7 1 2; 4 9 8]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eor\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = [1 2; 3 4; 5 6]\\ny = [1 2 3; 4 5 6]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease note that the matrices can have different shapes or sizes!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44266,"title":"Sort the prime numbers in each row of a matrix","description":"Considering a 3x3 matrix A, sort the prime numbers of each row in ascending order. For exemple:\r\n\r\n  \r\n      input A=[5 8 2 4;\r\n               1 11 1 5]\r\n  \r\n  output B=[2 8 5 4;\r\n            1 5 1 11]\r\n  \r\n\r\nYou don't have to sort the other numbers, just the prime numbers.\r\nEnjoy!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 164.167px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.0833px; transform-origin: 407px 82.0833px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 292px 8px; transform-origin: 292px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eConsidering a matrix A, sort the prime numbers of each row in ascending order. For exemple:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 102.167px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 51.0833px; transform-origin: 404px 51.0833px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 92px 8.5px; transform-origin: 92px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 48px 8.5px; transform-origin: 48px 8.5px; \"\u003e      input \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 40px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 40px 8.5px; \"\u003eA=[5 8 2 4\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 96px 8.5px; transform-origin: 96px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e               1 11 1 5]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 72px 8.5px; transform-origin: 72px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 28px 8.5px; transform-origin: 28px 8.5px; \"\u003eoutput \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 40px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 40px 8.5px; \"\u003eB=[2 8 5 4\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 76px 8.5px; transform-origin: 76px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e          1 5 1 11]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 229px 8px; transform-origin: 229px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou don't have to sort the other numbers, just the prime numbers. Enjoy!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function B = SrtPrimesInRows(A)\r\n","test_suite":"%%\r\nA=[5 8 2 4;1 11 1 5] ;               \r\nB_correct = [2 8 5 4;1 5 1 11];\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=[2 7 5; 1 11 2;2 2 2];\r\nB_correct=[2 5 7;1 2 11;2 2 2];\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=[111 12 134;333 654 100000;112227 38 1];\r\nB_correct=A;\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=ones(4);\r\nA(2,1:4)=[11 59 7 23];\r\nB_correct=[1 1 1 1;7 11 23 59;1 1 1 1;1 1 1 1];\r\nassert(isequal(SrtPrimesInRows(A),B_correct))\r\n%%\r\nA=reshape(flip(primes(40)),3,4);\r\nB_correct= flipud(reshape(primes(40),3,4));\r\nassert(isequal(SrtPrimesInRows(A),B_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":140751,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":39,"test_suite_updated_at":"2021-04-20T15:13:52.000Z","rescore_all_solutions":false,"group_id":674,"created_at":"2017-07-20T15:29:29.000Z","updated_at":"2026-03-04T15:19:28.000Z","published_at":"2017-07-20T15:29:29.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsidering a matrix A, sort the prime numbers of each row in ascending order. For exemple:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[      input A=[5 8 2 4;\\n               1 11 1 5]\\n\\noutput B=[2 8 5 4;\\n          1 5 1 11]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou don't have to sort the other numbers, just the prime numbers. Enjoy!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":431,"title":"Indirect Sorting","description":"Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.\r\n\r\nExample:\r\n\r\n Input  = [1 2 3 4 5;\r\n           4 3 1 2 2]'\r\n\r\n Output = [3 4 5 2 1]'\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 142.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 71.3667px; transform-origin: 407px 71.3667px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373px 8px; transform-origin: 373px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAssume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.5px 8px; transform-origin: 28.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 84px 8.5px; transform-origin: 84px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e Input  = [1 2 3 4 5;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 88px 8.5px; transform-origin: 88px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e           4 3 1 2 2]'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 88px 8.5px; transform-origin: 88px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e Output = [3 4 5 2 1]'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sort2(x)\r\n","test_suite":"%%\r\nx = [1 2 3 4 5;4 3 1 2 2]';\r\ny_correct = [3 4 5 2 1]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [3 1 2;1 -1 0]';\r\ny_correct = [1 2 3]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [7 2 1 5 10 3 6; 2 8 3 5 7 9 10]';\r\ny_correct = [7 1 5 10 2 3 6]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [1:10;10:-1:1]';\r\ny_correct = [10:-1:1]';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = [13 2 23 7 29 5 19 17 3 11; 13 8 16 11 17 10 15 14 9 12]';\r\ny_correct = primes(30)';\r\nassert(isequal(sort2(x),y_correct))\r\n\r\n%%\r\nx = reshape(magic(4),[],2);\r\ny_correct = [14 16 9 11 5 7 2 4]';\r\nassert(isequal(sort2(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":1939,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":316,"test_suite_updated_at":"2021-04-26T10:01:18.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2012-03-01T15:09:37.000Z","updated_at":"2026-03-16T10:24:51.000Z","published_at":"2012-03-01T15:09:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAssume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  = [1 2 3 4 5;\\n           4 3 1 2 2]'\\n\\n Output = [3 4 5 2 1]']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":61024,"title":"The Case of the Missing Prototype – Restore the Correct Frame Order from the Corrupted Security Camera Footage","description":"You’ve finally recovered the security camera footage from the Innovation Lab,but the system malfunctioned and stored frames in the wrong order.Each frame is represented by a number in the vector frames.Reordering the footage might reveal who entered the lab that night!\r\nYour task is to restore the video to its proper sequence by arranging all frame numbers in ascending order.\r\nReturn the corrected vector of frame numbers.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 123px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 61.5px; transform-origin: 408px 61.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 31.5px; text-align: left; transform-origin: 385px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou’ve finally recovered the security camera footage from the Innovation Lab,but the system malfunctioned and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003estored frames in the wrong order\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.Each frame is represented by a number in the vector \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eframes\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.Reordering the footage might reveal who entered the lab that night!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYour task is to restore the video to its proper sequence by arranging all frame numbers in \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eascending order\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn the corrected vector of frame numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = restoreFrames(frames)\r\n  y = x;\r\nend","test_suite":"%%\r\nframes = [3 1 4 2];\r\ny_correct = [1 2 3 4];\r\nassert(isequal(restoreFrames(frames),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":52,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-20T16:50:43.000Z","updated_at":"2026-04-03T03:53:05.000Z","published_at":"2025-10-20T16:50:43.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou’ve finally recovered the security camera footage from the Innovation Lab,but the system malfunctioned and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003estored frames in the wrong order\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.Each frame is represented by a number in the vector \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eframes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.Reordering the footage might reveal who entered the lab that night!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task is to restore the video to its proper sequence by arranging all frame numbers in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eascending order\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the corrected vector of frame numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":47508,"title":"Convert sorting indices to ranks","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe second output of sort() is the sorting index vector, telling where the corresponding element in the sorted vector was in the raw vector. However sometimes we want to know where the elements of the raw vector goes into the sorted vector, i.e., ranks.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eCan you find the shortest solution?\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function Ranks = SortingIndices2Ranks(SortingIndices)\r\n  Ranks=SortingIndices;\r\nend","test_suite":"%%\r\nRawVector=rand(10,1);\r\n[SortedVector,SortingIndices]=sort(RawVector);\r\nRanks=SortingIndices2Ranks(SortingIndices);\r\nassert(isequal(SortedVector(Ranks),RawVector));","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":362068,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-11-15T04:05:17.000Z","updated_at":"2025-11-28T17:59:25.000Z","published_at":"2020-11-15T04:05:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe second output of sort() is the sorting index vector, telling where the corresponding element in the sorted vector was in the raw vector. However sometimes we want to know where the elements of the raw vector goes into the sorted vector, i.e., ranks.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCan you find the shortest solution?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":54910,"title":"Vector slither sort!","description":"Sort a numeric vector in the following format:\r\n[largest value, smallest value, second largest value, second smallest value, etc.]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 140px 8px; transform-origin: 140px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort a numeric vector in the following format:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 251.5px 8px; transform-origin: 251.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e[largest value, smallest value, second largest value, second smallest value, etc.]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = slither_sort(x)\r\n    y = x\r\nend","test_suite":"%% TEST 1\r\nx = [1,3,2,5,6];\r\ny_correct = [6,1,5,2,3];\r\nassert(isequal(slither_sort(x),y_correct))\r\n%% TEST 2\r\nx = [5,2,6,1,6];\r\ny_correct = [6,1,6,2,5];\r\nassert(isequal(slither_sort(x),y_correct))\r\n%% TEST 3\r\nx = [5,1,8,9];\r\ny_correct = [9,1,8,5];\r\nassert(isequal(slither_sort(x),y_correct))\r\n%% TEST 4\r\nx = -5:5;\r\ny_correct = [5,-5,4,-4,3,-3,2,-2,1,-1,0];\r\nassert(isequal(slither_sort(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2435125,"edited_by":223089,"edited_at":"2022-08-20T17:28:03.000Z","deleted_by":null,"deleted_at":null,"solvers_count":23,"test_suite_updated_at":"2022-08-20T17:28:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-07-12T15:20:17.000Z","updated_at":"2026-03-06T12:26:36.000Z","published_at":"2022-07-12T15:20:17.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a numeric vector in the following format:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e[largest value, smallest value, second largest value, second smallest value, etc.]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43609,"title":"Sort rows of a matrix","description":"Sort rows of matrix A in an ascending order according to the last column\r\n\r\nExample input:\r\n\r\n  A = [1 2 3;7 8 9;4 5 6];\r\n\r\nExample output:\r\n\r\n  A = [1 2 3;4 5 6;7 8 9];\r\n","description_html":"\u003cp\u003eSort rows of matrix A in an ascending order according to the last column\u003c/p\u003e\u003cp\u003eExample input:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eA = [1 2 3;7 8 9;4 5 6];\r\n\u003c/pre\u003e\u003cp\u003eExample output:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eA = [1 2 3;4 5 6;7 8 9];\r\n\u003c/pre\u003e","function_template":"function y = your_fcn_name(A)\r\n y = ?;\r\nend","test_suite":"%%\r\nA = magic(5);\r\ny_correct = [10 12 19 21  3;\r\n             11 18 25  2  9;\r\n             17 24  1  8 15;\r\n             23  5  7 14 16;\r\n              4  6 13 20 22];\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = 1:5;\r\ny_correct = A;\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = [1:4; 9:12; 13:16; 5:8];\r\ny_correct = reshape((1:16),[4,4])';\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = (1:10)';\r\ny_correct = A;\r\nind = rand(10,1); [~,indA] = sort(ind); A = A(indA);\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n\r\n%%\r\nA = [3:7; 10:-1:6; -4:0; 2:-1:-2];\r\ny_correct = flipud(A);\r\nassert(isequal(your_fcn_name(A),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":97,"test_suite_updated_at":"2016-12-05T18:47:25.000Z","rescore_all_solutions":false,"group_id":24,"created_at":"2016-10-24T15:59:33.000Z","updated_at":"2026-04-01T07:37:12.000Z","published_at":"2016-10-24T15:59:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort rows of matrix A in an ascending order according to the last column\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample input:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[A = [1 2 3;7 8 9;4 5 6];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample output:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[A = [1 2 3;4 5 6;7 8 9];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45508,"title":"AK Sorting according to given order","description":"Conventional ascending order of one digit number is [ 0, 1, 2, ......9]. Now this order is changed and stored in vector a. For example in a vector a = [3 8 7 5 0 9 2 1 6 4], first element 3 denotes the lowest value equal to 0 like in conventional representation and last element 4 denotes the highest value equal to 9 in conventional representation. \r\nAnother vector b is unsorted one. You need to sort the vector b according the new order expressed by vector a. \r\nFor a given vector b =[ 2 4 5 5 3 3 3 9 0] the sorted sequence is [3 3 3 5 5 0 9 2 4] and which should be stored in another vector named c.\r\n\r\nExample :\r\na= [ 3 8 7 5 0 9 2 1 6 4] % In this order '3' is considered as the smallest number and '4' is considered as largest number.\r\nb= [ 2 4 5 5 3 3 3 9 0] % This sequence is to be sorted according to the order in 'a'.\r\n\r\ntherefore, The should be,\r\nc=[3 3 3 5 5 0 9 2 4]\r\n \r\n\r\nComment: Consider both a \u0026 b are made using the digits from 0 to 9 only\r\n","description_html":"\u003cp\u003eConventional ascending order of one digit number is [ 0, 1, 2, ......9]. Now this order is changed and stored in vector a. For example in a vector a = [3 8 7 5 0 9 2 1 6 4], first element 3 denotes the lowest value equal to 0 like in conventional representation and last element 4 denotes the highest value equal to 9 in conventional representation. \r\nAnother vector b is unsorted one. You need to sort the vector b according the new order expressed by vector a. \r\nFor a given vector b =[ 2 4 5 5 3 3 3 9 0] the sorted sequence is [3 3 3 5 5 0 9 2 4] and which should be stored in another vector named c.\u003c/p\u003e\u003cp\u003eExample :\r\na= [ 3 8 7 5 0 9 2 1 6 4] % In this order '3' is considered as the smallest number and '4' is considered as largest number.\r\nb= [ 2 4 5 5 3 3 3 9 0] % This sequence is to be sorted according to the order in 'a'.\u003c/p\u003e\u003cp\u003etherefore, The should be,\r\nc=[3 3 3 5 5 0 9 2 4]\u003c/p\u003e\u003cp\u003eComment: Consider both a \u0026 b are made using the digits from 0 to 9 only\u003c/p\u003e","function_template":"function c = ak_sorting(a,b)\r\n  c = a+b;\r\nend","test_suite":"%%\r\na = [ 3 8 7 5 0 9 2 1 6 4];\r\nb= [ 2 4 5 5 3 3 3 9 0];\r\nc_correct =[3,3,3,5,5,0,9,2,4];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n%%\r\na = [ 0 1 2 3 4 5 6 7 8 9];\r\nb= [ 5 6 7 3 5 1 9 0 5 6 7 8 2 4 5];\r\nc_correct = [0 1 2 3 4 5 5 5 5 6 6 7 7 8 9];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n%%\r\na = [ 9 8 7 6 5 4 3 2 1 0];\r\nb= [3 4 1 2 3 4 1 2 3 4 1 2];\r\nc_correct = [4 4 4 3 3 3 2 2 2 1 1 1];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n%%\r\na = [4 5 7 8 0 3 1 2 9 6];\r\nb= [5 4 3 8 7 6 5 4 3 5 3 2 1 0 9 1];\r\nc_correct = [4 4 5 5 5 7 8 0 3 3 3 1 1 2 9 6];\r\nassert(isequal(ak_sorting(a,b),c_correct))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":363758,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-05-11T08:49:51.000Z","updated_at":"2026-02-02T20:15:48.000Z","published_at":"2020-05-11T09:19:01.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConventional ascending order of one digit number is [ 0, 1, 2, ......9]. Now this order is changed and stored in vector a. For example in a vector a = [3 8 7 5 0 9 2 1 6 4], first element 3 denotes the lowest value equal to 0 like in conventional representation and last element 4 denotes the highest value equal to 9 in conventional representation. Another vector b is unsorted one. You need to sort the vector b according the new order expressed by vector a. For a given vector b =[ 2 4 5 5 3 3 3 9 0] the sorted sequence is [3 3 3 5 5 0 9 2 4] and which should be stored in another vector named c.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample : a= [ 3 8 7 5 0 9 2 1 6 4] % In this order '3' is considered as the smallest number and '4' is considered as largest number. b= [ 2 4 5 5 3 3 3 9 0] % This sequence is to be sorted according to the order in 'a'.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003etherefore, The should be, c=[3 3 3 5 5 0 9 2 4]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eComment: Consider both a \u0026amp; b are made using the digits from 0 to 9 only\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44899,"title":"D'Hondt Method of Proportional-Representation","description":"The D'Hondt method is a proportional representational method for allocating seats to parties in an election.\r\n\r\n\u003chttps://en.wikipedia.org/wiki/D%27Hondt_method\u003e\r\n\r\nTake a vector of *votes* cast for a number of parties and the total number of *seats* to be won.  Return a vector of the same size showing the *allocation* of the seats won.\r\n\r\nThe process is:\r\n\r\n# Allocate 1 seat to the party with the most votes\r\n# Divide that party's _original_ number of votes by the number of seats allocated to it + 1.\r\n# Repeat until all seats have been allocated\r\n\r\nNote: the total number of seats to be won will always be a positive integer and no ties will need to be resolved to allocate the seats.","description_html":"\u003cp\u003eThe D'Hondt method is a proportional representational method for allocating seats to parties in an election.\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://en.wikipedia.org/wiki/D%27Hondt_method\"\u003ehttps://en.wikipedia.org/wiki/D%27Hondt_method\u003c/a\u003e\u003c/p\u003e\u003cp\u003eTake a vector of \u003cb\u003evotes\u003c/b\u003e cast for a number of parties and the total number of \u003cb\u003eseats\u003c/b\u003e to be won.  Return a vector of the same size showing the \u003cb\u003eallocation\u003c/b\u003e of the seats won.\u003c/p\u003e\u003cp\u003eThe process is:\u003c/p\u003e\u003col\u003e\u003cli\u003eAllocate 1 seat to the party with the most votes\u003c/li\u003e\u003cli\u003eDivide that party's \u003ci\u003eoriginal\u003c/i\u003e number of votes by the number of seats allocated to it + 1.\u003c/li\u003e\u003cli\u003eRepeat until all seats have been allocated\u003c/li\u003e\u003c/ol\u003e\u003cp\u003eNote: the total number of seats to be won will always be a positive integer and no ties will need to be resolved to allocate the seats.\u003c/p\u003e","function_template":"function allocation = dHondt(votes,seats)\r\n  allocation = [];\r\nend","test_suite":"%%\r\nvotes = [100];\r\nseats = 1;\r\nv_c   = 1;\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\nvotes = [30,40,60,50];\r\nseats = 1;\r\nv_c   = [0,0,1,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\nvotes = [428010,363033,330470,75648,71464];\r\nseats = 7;\r\nv_c   = [3,2,2,0,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\nvotes = [80000,30000,100000,20000];\r\nseats = 8;\r\nv_c   = [3,1,4,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n\r\n%%\r\n\r\nvotes = [100,800,1000,800,600,100];\r\nseats = 9;\r\nv_c   = [0,2,3,2,2,0];\r\nassert(isequal(dHondt(votes,seats),v_c))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":301584,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-05-17T09:23:47.000Z","updated_at":"2025-11-27T19:15:20.000Z","published_at":"2019-10-14T19:49:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe D'Hondt method is a proportional representational method for allocating seats to parties in an election.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/D%27Hondt_method\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://en.wikipedia.org/wiki/D%27Hondt_method\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake a vector of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003evotes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e cast for a number of parties and the total number of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eseats\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be won. Return a vector of the same size showing the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eallocation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of the seats won.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe process is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAllocate 1 seat to the party with the most votes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivide that party's\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoriginal\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e number of votes by the number of seats allocated to it + 1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRepeat until all seats have been allocated\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNote: the total number of seats to be won will always be a positive integer and no ties will need to be resolved to allocate the seats.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1894,"title":"GJam 2014 China Rd A: Library Sorting (Large)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2924486/dashboard#s=p2 GJam 2014 China Sorting\u003e.  Subset of cases.\r\n\r\nThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations. \r\n\r\n*Input:* V   a vector\r\n\r\n*Output:* Vout  a sorted vector Odds Increasing/Evens Increasing\r\n\r\n*Example:*\r\n\r\nV= [-5 -12 87 2 88 20 11]\r\n\r\nVout=[-5 88 11 20 2 -12 87]\r\n\r\n\r\n*Contest Performance:*  Best Time to Complete: \u003c 10 minutes","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\"\u003eGJam 2014 China Sorting\u003c/a\u003e.  Subset of cases.\u003c/p\u003e\u003cp\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V   a vector\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Vout  a sorted vector Odds Increasing/Evens Increasing\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eV= [-5 -12 87 2 88 20 11]\u003c/p\u003e\u003cp\u003eVout=[-5 88 11 20 2 -12 87]\u003c/p\u003e\u003cp\u003e\u003cb\u003eContest Performance:\u003c/b\u003e  Best Time to Complete: \u0026lt; 10 minutes\u003c/p\u003e","function_template":"function vout=Sort_CH(v)\r\n vout=v;\r\nend","test_suite":"%%\r\ntic\r\nv=[1 ];\r\nvexp=[1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[2 1 ];\r\nvexp=[2 1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 ];\r\nvexp=[1 2 3 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 4 5 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[5 2 3 4 1 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[994 994 -981 -975 -971 980 -971 976 -969 -969 968 968 958 -963 -957 948 -955 932 926 -935 924 -931 -923 -917 922 -917 -909 -899 916 914 -899 -877 -871 -871 -867 -847 912 -829 912 -825 -819 -817 910 -811 -805 -803 -801 904 -791 -783 -745 -731 902 -725 -725 -715 900 896 -707 896 -705 -705 -693 -691 882 -687 -685 -683 -671 -663 882 -663 880 880 -651 -651 -637 876 -637 -623 -613 -605 -601 -577 -577 862 -571 -565 856 848 -559 -559 -555 -553 844 -551 840 828 -547 -539 -527 812 -525 806 802 -505 -503 -497 -497 -495 798 -493 -491 -483 -481 798 770 770 -481 770 762 758 -477 -469 -463 -457 756 -455 -451 -441 -439 -431 -429 752 -427 -413 -409 742 -403 726 -391 722 -389 -385 718 -379 -365 -363 -359 712 702 -355 -351 682 -347 682 674 672 -343 672 -325 664 -319 -319 -315 -309 -297 -287 -285 -279 662 658 -277 658 656 650 -275 644 -259 -259 -259 630 -255 -251 -245 -231 -231 -225 -221 -219 -215 628 616 -213 612 -209 -209 598 -207 -203 -193 594 -191 -165 594 574 -163 -137 -129 -129 -119 -119 -119 -113 -111 572 564 560 -101 -99 -93 -91 546 -91 546 -91 542 -67 534 -63 528 -57 -55 -55 -49 -39 -37 522 -35 -31 520 -29 -25 -21 -17 -15 -11 -11 514 510 500 -9 494 -5 15 17 490 23 490 484 33 476 33 47 464 49 59 63 77 462 462 77 460 458 77 77 81 444 444 95 442 97 99 105 105 107 111 113 117 434 424 420 119 133 416 408 394 380 376 135 143 143 376 374 147 368 175 342 338 338 336 185 187 195 195 336 197 197 334 201 326 203 316 312 312 308 308 300 211 286 219 219 237 239 247 249 251 253 259 265 273 284 277 262 258 283 285 287 289 297 248 242 303 305 319 327 335 351 357 385 385 238 232 220 397 399 401 210 403 407 210 210 409 204 411 200 415 425 425 200 429 198 429 198 196 192 190 186 433 435 441 451 463 473 473 182 483 182 495 176 170 154 507 507 150 148 509 529 533 148 130 128 124 112 539 96 551 555 70 561 70 565 577 581 581 585 599 70 609 58 56 611 44 613 44 621 625 625 36 627 28 26 2 627 637 647 651 0 685 689 689 689 0 693 693 693 0 -10 -14 -40 -42 -44 697 -56 705 707 715 -56 -64 715 719 -66 -66 721 729 729 731 741 741 763 763 -74 767 775 811 815 819 827 833 -78 845 845 -80 -82 847 847 847 851 867 -84 869 869 869 871 -86 873 -98 -98 -104 875 875 879 887 911 935 -118 935 -120 949 951 965 973 975 979 -128 -132 -138 -140 -150 -154 -154 -164 -172 -174 -188 -196 -198 -200 -204 -208 -214 -216 -224 -228 -238 -242 -242 -250 -260 -260 -280 -286 -294 -296 -298 -302 -304 -308 -324 -330 -336 -336 -340 -342 -342 -344 -352 -352 -360 -360 -364 -364 -366 -368 -370 -378 -384 -384 -384 -392 -392 -396 -402 -402 -406 -410 -410 -416 -420 -420 -420 -432 -436 -440 -442 -458 -462 -470 -478 -482 -494 -500 -502 -504 -514 -520 -524 -530 -532 -534 -546 -548 -550 -550 -552 -558 -560 -566 -572 -572 -594 -598 -600 -602 -616 -626 -632 -638 -640 -650 -652 -664 -666 -676 -676 -684 -694 -700 -704 -710 -714 -720 -728 -728 -732 -738 -750 -758 -758 -776 -778 -782 -792 -794 -798 -798 -808 -810 -812 -814 -814 -818 -826 -836 -846 -856 -858 -858 -858 -860 -866 -866 -886 -892 -896 -900 -902 -906 -910 -910 -910 -924 -926 -926 -934 -938 -940 -942 -944 -946 -952 -952 -966 -966 -968 -968 -976 ];\r\nvexp=[994 994 -981 -975 -971 980 -971 976 -969 -969 968 968 958 -963 -957 948 -955 932 926 -935 924 -931 -923 -917 922 -917 -909 -899 916 914 -899 -877 -871 -871 -867 -847 912 -829 912 -825 -819 -817 910 -811 -805 -803 -801 904 -791 -783 -745 -731 902 -725 -725 -715 900 896 -707 896 -705 -705 -693 -691 882 -687 -685 -683 -671 -663 882 -663 880 880 -651 -651 -637 876 -637 -623 -613 -605 -601 -577 -577 862 -571 -565 856 848 -559 -559 -555 -553 844 -551 840 828 -547 -539 -527 812 -525 806 802 -505 -503 -497 -497 -495 798 -493 -491 -483 -481 798 770 770 -481 770 762 758 -477 -469 -463 -457 756 -455 -451 -441 -439 -431 -429 752 -427 -413 -409 742 -403 726 -391 722 -389 -385 718 -379 -365 -363 -359 712 702 -355 -351 682 -347 682 674 672 -343 672 -325 664 -319 -319 -315 -309 -297 -287 -285 -279 662 658 -277 658 656 650 -275 644 -259 -259 -259 630 -255 -251 -245 -231 -231 -225 -221 -219 -215 628 616 -213 612 -209 -209 598 -207 -203 -193 594 -191 -165 594 574 -163 -137 -129 -129 -119 -119 -119 -113 -111 572 564 560 -101 -99 -93 -91 546 -91 546 -91 542 -67 534 -63 528 -57 -55 -55 -49 -39 -37 522 -35 -31 520 -29 -25 -21 -17 -15 -11 -11 514 510 500 -9 494 -5 15 17 490 23 490 484 33 476 33 47 464 49 59 63 77 462 462 77 460 458 77 77 81 444 444 95 442 97 99 105 105 107 111 113 117 434 424 420 119 133 416 408 394 380 376 135 143 143 376 374 147 368 175 342 338 338 336 185 187 195 195 336 197 197 334 201 326 203 316 312 312 308 308 300 211 286 219 219 237 239 247 249 251 253 259 265 273 284 277 262 258 283 285 287 289 297 248 242 303 305 319 327 335 351 357 385 385 238 232 220 397 399 401 210 403 407 210 210 409 204 411 200 415 425 425 200 429 198 429 198 196 192 190 186 433 435 441 451 463 473 473 182 483 182 495 176 170 154 507 507 150 148 509 529 533 148 130 128 124 112 539 96 551 555 70 561 70 565 577 581 581 585 599 70 609 58 56 611 44 613 44 621 625 625 36 627 28 26 2 627 637 647 651 0 685 689 689 689 0 693 693 693 0 -10 -14 -40 -42 -44 697 -56 705 707 715 -56 -64 715 719 -66 -66 721 729 729 731 741 741 763 763 -74 767 775 811 815 819 827 833 -78 845 845 -80 -82 847 847 847 851 867 -84 869 869 869 871 -86 873 -98 -98 -104 875 875 879 887 911 935 -118 935 -120 949 951 965 973 975 979 -128 -132 -138 -140 -150 -154 -154 -164 -172 -174 -188 -196 -198 -200 -204 -208 -214 -216 -224 -228 -238 -242 -242 -250 -260 -260 -280 -286 -294 -296 -298 -302 -304 -308 -324 -330 -336 -336 -340 -342 -342 -344 -352 -352 -360 -360 -364 -364 -366 -368 -370 -378 -384 -384 -384 -392 -392 -396 -402 -402 -406 -410 -410 -416 -420 -420 -420 -432 -436 -440 -442 -458 -462 -470 -478 -482 -494 -500 -502 -504 -514 -520 -524 -530 -532 -534 -546 -548 -550 -550 -552 -558 -560 -566 -572 -572 -594 -598 -600 -602 -616 -626 -632 -638 -640 -650 -652 -664 -666 -676 -676 -684 -694 -700 -704 -710 -714 -720 -728 -728 -732 -738 -750 -758 -758 -776 -778 -782 -792 -794 -798 -798 -808 -810 -812 -814 -814 -818 -826 -836 -846 -856 -858 -858 -858 -860 -866 -866 -886 -892 -896 -900 -902 -906 -910 -910 -910 -924 -926 -926 -934 -938 -940 -942 -944 -946 -952 -952 -966 -966 -968 -968 -976 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-979 990 -975 -973 -971 -955 990 -953 -943 -937 -925 -921 986 -917 -913 -911 -909 984 -905 -903 -901 -897 -897 -889 -877 -875 980 968 -875 -871 -861 966 -861 -859 -855 948 942 -823 -821 -811 -805 -805 -797 -795 -793 -793 -793 938 -791 936 -781 -779 936 924 -775 -775 -767 924 920 -757 -755 914 -755 -751 -751 -749 906 -749 906 -745 -745 902 -741 902 -737 898 -735 -729 -727 894 882 868 -723 -709 862 858 858 -705 842 842 838 -693 -681 -679 838 -665 -651 -641 -629 -627 836 -627 828 -623 -623 824 -617 -585 -575 -571 -563 816 -561 -561 -559 -559 -549 808 -539 -539 -535 796 -533 -533 -527 792 -525 788 -525 -521 -517 788 -517 -511 -511 -493 756 -491 756 752 -485 -477 736 -465 -455 -453 716 -451 -441 -429 714 712 712 -427 -407 710 -399 -393 -393 -391 -385 -381 710 -379 702 700 698 -371 -371 -371 -359 -349 684 -341 672 -339 -337 -331 -319 652 636 -315 636 -315 -303 630 630 630 -301 -301 -297 -297 630 -297 -295 -291 -287 -281 624 -267 -267 624 -255 624 -247 616 -247 608 -245 -243 -241 -237 -237 -233 -231 -225 -221 -205 -201 604 -193 602 -185 602 600 -175 -167 -167 598 594 594 -163 -143 -143 588 584 -139 582 578 -133 -121 -117 -103 -95 -91 -89 -65 -65 -55 574 -49 572 -45 572 -39 572 -39 -35 -35 570 -31 -23 -19 560 -7 560 548 7 542 7 9 532 11 11 31 33 37 532 55 532 522 71 77 520 506 504 500 85 91 91 496 494 91 490 93 93 95 448 105 448 440 107 109 111 117 436 125 416 125 404 129 133 384 137 139 141 143 378 378 143 374 364 362 360 147 147 151 352 157 352 338 159 169 181 336 187 203 332 205 330 207 207 219 223 326 318 229 308 231 231 298 294 239 292 239 243 253 292 257 259 261 273 286 284 275 281 287 295 295 297 297 299 307 307 311 313 313 282 278 276 272 264 327 250 329 333 248 343 246 343 242 349 351 353 357 359 363 377 379 381 385 242 385 385 240 389 226 226 401 226 403 405 417 419 226 429 429 429 431 222 461 463 216 477 481 483 483 214 495 204 198 188 497 507 507 184 184 517 519 531 182 533 182 535 539 539 545 567 573 587 180 589 595 174 154 595 595 144 597 144 609 623 144 631 637 637 657 142 659 132 663 130 665 665 669 679 689 126 693 124 693 106 697 701 100 707 100 709 715 715 98 721 723 733 88 737 72 66 52 52 50 40 737 749 749 34 755 759 767 34 769 32 771 26 26 26 773 26 779 14 783 8 0 787 791 0 791 793 0 793 0 815 817 819 819 -10 819 819 819 821 821 823 827 -14 827 831 845 -38 859 861 -42 865 873 877 881 891 893 909 -44 -50 911 913 915 921 923 935 945 945 951 -50 -52 -54 953 -64 -66 -68 -80 959 961 -82 -84 -92 967 975 -98 -98 -106 -110 -110 -112 -122 -126 -140 -140 -144 -148 -154 -154 -154 -154 -162 -162 -168 -172 -182 -182 -204 -204 -208 -220 -220 -228 -232 -240 -248 -252 -254 -256 -256 -264 -266 -276 -280 -286 -286 -286 -294 -294 -294 -296 -300 -300 -300 -306 -310 -312 -314 -314 -320 -346 -346 -362 -362 -366 -368 -368 -370 -378 -380 -380 -384 -392 -392 -410 -410 -412 -424 -430 -430 -434 -434 -434 -436 -436 -438 -438 -442 -444 -444 -448 -462 -468 -480 -488 -494 -506 -512 -512 -518 -530 -530 -536 -536 -536 -546 -546 -548 -550 -554 -556 -560 -560 -578 -580 -590 -590 -596 -596 -598 -598 -610 -612 -616 -616 -618 -626 -630 -634 -636 -638 -640 -642 -644 -644 -644 -648 -652 -654 -664 -674 -674 -686 -698 -700 -702 -708 -714 -714 -716 -718 -722 -726 -728 -728 -740 -742 -744 -750 -752 -756 -762 -766 -766 -768 -770 -770 -770 -778 -778 -780 -782 -786 -786 -792 -792 -798 -806 -810 -812 -820 -828 -844 -858 -858 -858 -860 -872 -874 -880 -882 -882 -888 -888 -890 -896 -902 -910 -912 -924 -924 -936 -938 -956 -956 -968 -980 -980 -980 -982 -988 -990 -994 -996 -998 ];\r\nvexp=[-979 990 -975 -973 -971 -955 990 -953 -943 -937 -925 -921 986 -917 -913 -911 -909 984 -905 -903 -901 -897 -897 -889 -877 -875 980 968 -875 -871 -861 966 -861 -859 -855 948 942 -823 -821 -811 -805 -805 -797 -795 -793 -793 -793 938 -791 936 -781 -779 936 924 -775 -775 -767 924 920 -757 -755 914 -755 -751 -751 -749 906 -749 906 -745 -745 902 -741 902 -737 898 -735 -729 -727 894 882 868 -723 -709 862 858 858 -705 842 842 838 -693 -681 -679 838 -665 -651 -641 -629 -627 836 -627 828 -623 -623 824 -617 -585 -575 -571 -563 816 -561 -561 -559 -559 -549 808 -539 -539 -535 796 -533 -533 -527 792 -525 788 -525 -521 -517 788 -517 -511 -511 -493 756 -491 756 752 -485 -477 736 -465 -455 -453 716 -451 -441 -429 714 712 712 -427 -407 710 -399 -393 -393 -391 -385 -381 710 -379 702 700 698 -371 -371 -371 -359 -349 684 -341 672 -339 -337 -331 -319 652 636 -315 636 -315 -303 630 630 630 -301 -301 -297 -297 630 -297 -295 -291 -287 -281 624 -267 -267 624 -255 624 -247 616 -247 608 -245 -243 -241 -237 -237 -233 -231 -225 -221 -205 -201 604 -193 602 -185 602 600 -175 -167 -167 598 594 594 -163 -143 -143 588 584 -139 582 578 -133 -121 -117 -103 -95 -91 -89 -65 -65 -55 574 -49 572 -45 572 -39 572 -39 -35 -35 570 -31 -23 -19 560 -7 560 548 7 542 7 9 532 11 11 31 33 37 532 55 532 522 71 77 520 506 504 500 85 91 91 496 494 91 490 93 93 95 448 105 448 440 107 109 111 117 436 125 416 125 404 129 133 384 137 139 141 143 378 378 143 374 364 362 360 147 147 151 352 157 352 338 159 169 181 336 187 203 332 205 330 207 207 219 223 326 318 229 308 231 231 298 294 239 292 239 243 253 292 257 259 261 273 286 284 275 281 287 295 295 297 297 299 307 307 311 313 313 282 278 276 272 264 327 250 329 333 248 343 246 343 242 349 351 353 357 359 363 377 379 381 385 242 385 385 240 389 226 226 401 226 403 405 417 419 226 429 429 429 431 222 461 463 216 477 481 483 483 214 495 204 198 188 497 507 507 184 184 517 519 531 182 533 182 535 539 539 545 567 573 587 180 589 595 174 154 595 595 144 597 144 609 623 144 631 637 637 657 142 659 132 663 130 665 665 669 679 689 126 693 124 693 106 697 701 100 707 100 709 715 715 98 721 723 733 88 737 72 66 52 52 50 40 737 749 749 34 755 759 767 34 769 32 771 26 26 26 773 26 779 14 783 8 0 787 791 0 791 793 0 793 0 815 817 819 819 -10 819 819 819 821 821 823 827 -14 827 831 845 -38 859 861 -42 865 873 877 881 891 893 909 -44 -50 911 913 915 921 923 935 945 945 951 -50 -52 -54 953 -64 -66 -68 -80 959 961 -82 -84 -92 967 975 -98 -98 -106 -110 -110 -112 -122 -126 -140 -140 -144 -148 -154 -154 -154 -154 -162 -162 -168 -172 -182 -182 -204 -204 -208 -220 -220 -228 -232 -240 -248 -252 -254 -256 -256 -264 -266 -276 -280 -286 -286 -286 -294 -294 -294 -296 -300 -300 -300 -306 -310 -312 -314 -314 -320 -346 -346 -362 -362 -366 -368 -368 -370 -378 -380 -380 -384 -392 -392 -410 -410 -412 -424 -430 -430 -434 -434 -434 -436 -436 -438 -438 -442 -444 -444 -448 -462 -468 -480 -488 -494 -506 -512 -512 -518 -530 -530 -536 -536 -536 -546 -546 -548 -550 -554 -556 -560 -560 -578 -580 -590 -590 -596 -596 -598 -598 -610 -612 -616 -616 -618 -626 -630 -634 -636 -638 -640 -642 -644 -644 -644 -648 -652 -654 -664 -674 -674 -686 -698 -700 -702 -708 -714 -714 -716 -718 -722 -726 -728 -728 -740 -742 -744 -750 -752 -756 -762 -766 -766 -768 -770 -770 -770 -778 -778 -780 -782 -786 -786 -792 -792 -798 -806 -810 -812 -820 -828 -844 -858 -858 -858 -860 -872 -874 -880 -882 -882 -888 -888 -890 -896 -902 -910 -912 -924 -924 -936 -938 -956 -956 -968 -980 -980 -980 -982 -988 -990 -994 -996 -998 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-999 968 -991 -983 -977 -975 -973 952 -945 -935 -931 -919 -915 -905 -903 -885 -861 -847 940 -847 -841 938 -825 -821 -811 -809 936 924 902 -791 -779 -771 -767 884 884 880 -757 -735 -735 -717 -717 -715 -715 878 876 -699 -689 -665 -655 -655 -651 -581 -577 -567 -559 -555 -549 -547 -539 858 840 -515 -513 -507 -505 832 804 -477 -473 -467 -457 -443 802 -441 796 -407 -403 -389 792 -385 780 774 -383 -377 -325 -303 770 770 754 -281 742 -257 724 -251 -249 -237 -233 -227 -217 -211 -203 -195 712 704 -179 -177 -147 -119 -99 -77 -57 -49 700 682 670 -49 -39 -35 646 -31 640 -27 624 -5 15 23 31 620 33 588 580 35 53 578 65 560 65 67 71 75 77 79 546 522 506 91 95 103 504 109 117 119 121 478 125 143 145 155 462 163 165 167 175 458 456 454 452 181 189 195 215 229 231 231 257 448 257 448 265 273 432 283 420 325 341 408 343 365 365 397 399 399 411 415 423 423 429 386 435 382 380 437 443 364 364 455 467 364 354 479 330 495 505 505 306 537 539 278 561 563 567 567 573 595 619 258 623 625 647 665 693 699 713 719 721 258 733 737 749 757 819 252 839 238 853 855 224 863 867 871 182 883 893 897 182 182 903 176 150 903 913 136 919 931 933 128 965 967 118 975 993 108 102 98 88 60 42 30 18 14 12 -2 -10 -22 -22 -44 -48 -52 -52 -60 -70 -82 -88 -88 -110 -112 -116 -124 -130 -130 -132 -156 -174 -184 -204 -206 -210 -232 -234 -242 -252 -254 -264 -316 -330 -332 -338 -342 -348 -352 -354 -360 -364 -370 -372 -376 -380 -408 -428 -452 -462 -462 -462 -482 -486 -496 -506 -510 -516 -524 -526 -528 -532 -542 -572 -592 -604 -606 -624 -636 -642 -662 -670 -686 -686 -706 -728 -728 -736 -776 -788 -792 -792 -798 -804 -840 -902 -904 -910 -918 -952 -962 -962 -968 -978 -990 -994 -998 ];\r\nvexp=[-999 968 -991 -983 -977 -975 -973 952 -945 -935 -931 -919 -915 -905 -903 -885 -861 -847 940 -847 -841 938 -825 -821 -811 -809 936 924 902 -791 -779 -771 -767 884 884 880 -757 -735 -735 -717 -717 -715 -715 878 876 -699 -689 -665 -655 -655 -651 -581 -577 -567 -559 -555 -549 -547 -539 858 840 -515 -513 -507 -505 832 804 -477 -473 -467 -457 -443 802 -441 796 -407 -403 -389 792 -385 780 774 -383 -377 -325 -303 770 770 754 -281 742 -257 724 -251 -249 -237 -233 -227 -217 -211 -203 -195 712 704 -179 -177 -147 -119 -99 -77 -57 -49 700 682 670 -49 -39 -35 646 -31 640 -27 624 -5 15 23 31 620 33 588 580 35 53 578 65 560 65 67 71 75 77 79 546 522 506 91 95 103 504 109 117 119 121 478 125 143 145 155 462 163 165 167 175 458 456 454 452 181 189 195 215 229 231 231 257 448 257 448 265 273 432 283 420 325 341 408 343 365 365 397 399 399 411 415 423 423 429 386 435 382 380 437 443 364 364 455 467 364 354 479 330 495 505 505 306 537 539 278 561 563 567 567 573 595 619 258 623 625 647 665 693 699 713 719 721 258 733 737 749 757 819 252 839 238 853 855 224 863 867 871 182 883 893 897 182 182 903 176 150 903 913 136 919 931 933 128 965 967 118 975 993 108 102 98 88 60 42 30 18 14 12 -2 -10 -22 -22 -44 -48 -52 -52 -60 -70 -82 -88 -88 -110 -112 -116 -124 -130 -130 -132 -156 -174 -184 -204 -206 -210 -232 -234 -242 -252 -254 -264 -316 -330 -332 -338 -342 -348 -352 -354 -360 -364 -370 -372 -376 -380 -408 -428 -452 -462 -462 -462 -482 -486 -496 -506 -510 -516 -524 -526 -528 -532 -542 -572 -592 -604 -606 -624 -636 -642 -662 -670 -686 -686 -706 -728 -728 -736 -776 -788 -792 -792 -798 -804 -840 -902 -904 -910 -918 -952 -962 -962 -968 -978 -990 -994 -998 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[984 -997 -985 980 -983 978 -971 968 966 958 -969 952 -969 950 -963 944 -957 -955 936 -949 936 -949 -941 926 -935 -931 -917 -913 -913 -907 -903 -891 -861 924 922 918 916 912 902 894 -849 -847 -845 884 -837 878 878 -833 -827 876 862 836 834 832 822 822 -817 -809 -805 -803 -797 -791 804 786 784 -785 -773 778 -773 -763 -749 -749 -745 776 -741 -737 770 -737 -737 -735 -735 -731 -725 770 -723 -707 768 768 -707 762 760 -693 -683 -669 -667 750 746 740 -661 -649 -639 -637 -635 -609 730 728 -603 -595 728 -593 -589 -589 -585 -581 -581 728 -577 -567 -561 -547 724 -541 -539 -539 -539 -527 -525 -523 716 -517 -517 -515 714 702 702 676 -513 -487 -475 -471 672 -469 660 -467 652 -467 -467 634 632 -461 -457 -455 624 -455 -453 -451 624 618 -441 618 614 604 -439 -427 -413 -413 -409 -399 600 -399 594 -397 -387 594 -383 586 582 -377 580 580 -365 -359 -343 -337 578 -329 -327 -325 -323 -323 -315 -313 -301 -293 576 -275 576 572 572 572 -275 572 564 -273 -269 -259 560 -249 -249 560 -233 -233 552 -231 550 -219 -215 -215 -203 -197 -191 -189 -171 -169 -169 -163 -161 -159 -157 546 -155 -153 546 -151 -147 540 -147 -143 -143 -133 -131 -109 -109 -105 518 -105 -99 -99 -99 -99 -75 508 -73 -67 -63 -59 -55 508 -51 -39 -35 -35 506 504 -33 500 -21 -7 496 -7 3 7 11 11 486 482 11 13 15 27 33 35 35 37 37 41 53 55 65 65 77 97 101 113 117 121 476 125 129 472 133 135 468 143 143 151 462 151 151 167 462 462 167 167 167 169 462 189 189 191 193 460 193 195 207 215 217 221 225 225 231 239 460 239 249 448 446 253 265 265 273 283 442 297 299 301 440 307 311 436 436 434 319 325 331 428 418 331 416 333 339 339 349 416 349 359 359 363 363 363 377 385 395 399 399 403 407 417 408 423 431 435 402 400 445 451 453 396 465 467 386 374 364 477 481 364 497 507 507 511 360 511 511 523 531 551 569 577 344 583 587 340 589 330 318 316 595 312 609 310 310 609 609 611 611 611 615 619 621 623 631 637 308 284 284 278 272 272 262 254 641 651 667 252 252 244 669 671 683 242 685 242 234 234 689 234 693 228 693 701 713 224 220 214 713 715 721 725 212 733 735 735 735 210 206 206 737 741 741 198 196 745 753 763 767 196 771 196 188 186 184 182 771 182 783 789 803 811 817 817 823 835 837 839 182 839 841 847 849 853 182 853 861 182 180 865 869 873 875 879 180 176 881 881 891 897 176 174 172 172 897 897 911 921 923 160 156 923 152 144 144 931 943 138 134 122 118 114 112 949 112 949 112 949 953 959 959 959 961 961 104 971 92 90 88 975 979 991 993 80 78 72 72 70 70 66 58 46 40 36 28 28 14 10 2 0 0 0 0 0 -2 -10 -22 -28 -32 -40 -40 -44 -54 -54 -66 -76 -78 -82 -84 -94 -110 -126 -134 -140 -146 -148 -154 -154 -162 -166 -168 -174 -182 -182 -184 -196 -196 -202 -202 -204 -206 -206 -208 -216 -220 -220 -232 -234 -242 -244 -254 -270 -286 -286 -288 -292 -294 -300 -306 -314 -322 -328 -336 -336 -340 -352 -360 -366 -368 -368 -374 -378 -392 -396 -396 -396 -396 -404 -404 -408 -416 -420 -422 -422 -424 -424 -426 -426 -432 -434 -436 -440 -440 -442 -444 -448 -448 -450 -460 -462 -464 -472 -474 -476 -480 -494 -494 -504 -506 -514 -516 -520 -520 -542 -542 -562 -564 -564 -572 -572 -572 -574 -584 -590 -590 -594 -600 -608 -616 -616 -616 -618 -622 -624 -626 -628 -654 -656 -664 -664 -676 -680 -682 -686 -700 -700 -702 -704 -704 -712 -722 -728 -728 -728 -730 -742 -742 -758 -768 -770 -778 -780 -780 -780 -782 -782 -784 -784 -786 -790 -792 -792 -812 -816 -818 -822 -834 -856 -858 -858 -866 -870 -870 -876 -880 -884 -886 -894 -902 -916 -916 -918 -918 -924 -924 -926 -926 -928 -936 -940 -948 -952 -952 -956 -962 -966 -966 -968 -976 -988 -988 -990 -992 -998 ];\r\nvexp=[984 -997 -985 980 -983 978 -971 968 966 958 -969 952 -969 950 -963 944 -957 -955 936 -949 936 -949 -941 926 -935 -931 -917 -913 -913 -907 -903 -891 -861 924 922 918 916 912 902 894 -849 -847 -845 884 -837 878 878 -833 -827 876 862 836 834 832 822 822 -817 -809 -805 -803 -797 -791 804 786 784 -785 -773 778 -773 -763 -749 -749 -745 776 -741 -737 770 -737 -737 -735 -735 -731 -725 770 -723 -707 768 768 -707 762 760 -693 -683 -669 -667 750 746 740 -661 -649 -639 -637 -635 -609 730 728 -603 -595 728 -593 -589 -589 -585 -581 -581 728 -577 -567 -561 -547 724 -541 -539 -539 -539 -527 -525 -523 716 -517 -517 -515 714 702 702 676 -513 -487 -475 -471 672 -469 660 -467 652 -467 -467 634 632 -461 -457 -455 624 -455 -453 -451 624 618 -441 618 614 604 -439 -427 -413 -413 -409 -399 600 -399 594 -397 -387 594 -383 586 582 -377 580 580 -365 -359 -343 -337 578 -329 -327 -325 -323 -323 -315 -313 -301 -293 576 -275 576 572 572 572 -275 572 564 -273 -269 -259 560 -249 -249 560 -233 -233 552 -231 550 -219 -215 -215 -203 -197 -191 -189 -171 -169 -169 -163 -161 -159 -157 546 -155 -153 546 -151 -147 540 -147 -143 -143 -133 -131 -109 -109 -105 518 -105 -99 -99 -99 -99 -75 508 -73 -67 -63 -59 -55 508 -51 -39 -35 -35 506 504 -33 500 -21 -7 496 -7 3 7 11 11 486 482 11 13 15 27 33 35 35 37 37 41 53 55 65 65 77 97 101 113 117 121 476 125 129 472 133 135 468 143 143 151 462 151 151 167 462 462 167 167 167 169 462 189 189 191 193 460 193 195 207 215 217 221 225 225 231 239 460 239 249 448 446 253 265 265 273 283 442 297 299 301 440 307 311 436 436 434 319 325 331 428 418 331 416 333 339 339 349 416 349 359 359 363 363 363 377 385 395 399 399 403 407 417 408 423 431 435 402 400 445 451 453 396 465 467 386 374 364 477 481 364 497 507 507 511 360 511 511 523 531 551 569 577 344 583 587 340 589 330 318 316 595 312 609 310 310 609 609 611 611 611 615 619 621 623 631 637 308 284 284 278 272 272 262 254 641 651 667 252 252 244 669 671 683 242 685 242 234 234 689 234 693 228 693 701 713 224 220 214 713 715 721 725 212 733 735 735 735 210 206 206 737 741 741 198 196 745 753 763 767 196 771 196 188 186 184 182 771 182 783 789 803 811 817 817 823 835 837 839 182 839 841 847 849 853 182 853 861 182 180 865 869 873 875 879 180 176 881 881 891 897 176 174 172 172 897 897 911 921 923 160 156 923 152 144 144 931 943 138 134 122 118 114 112 949 112 949 112 949 953 959 959 959 961 961 104 971 92 90 88 975 979 991 993 80 78 72 72 70 70 66 58 46 40 36 28 28 14 10 2 0 0 0 0 0 -2 -10 -22 -28 -32 -40 -40 -44 -54 -54 -66 -76 -78 -82 -84 -94 -110 -126 -134 -140 -146 -148 -154 -154 -162 -166 -168 -174 -182 -182 -184 -196 -196 -202 -202 -204 -206 -206 -208 -216 -220 -220 -232 -234 -242 -244 -254 -270 -286 -286 -288 -292 -294 -300 -306 -314 -322 -328 -336 -336 -340 -352 -360 -366 -368 -368 -374 -378 -392 -396 -396 -396 -396 -404 -404 -408 -416 -420 -422 -422 -424 -424 -426 -426 -432 -434 -436 -440 -440 -442 -444 -448 -448 -450 -460 -462 -464 -472 -474 -476 -480 -494 -494 -504 -506 -514 -516 -520 -520 -542 -542 -562 -564 -564 -572 -572 -572 -574 -584 -590 -590 -594 -600 -608 -616 -616 -616 -618 -622 -624 -626 -628 -654 -656 -664 -664 -676 -680 -682 -686 -700 -700 -702 -704 -704 -712 -722 -728 -728 -728 -730 -742 -742 -758 -768 -770 -778 -780 -780 -780 -782 -782 -784 -784 -786 -790 -792 -792 -812 -816 -818 -822 -834 -856 -858 -858 -866 -870 -870 -876 -880 -884 -886 -894 -902 -916 -916 -918 -918 -924 -924 -926 -926 -928 -936 -940 -948 -952 -952 -956 -962 -966 -966 -968 -976 -988 -988 -990 -992 -998 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-891 962 792 -851 784 730 -789 -781 662 662 -765 -737 -713 644 -567 -525 -465 534 -451 526 454 -427 -399 -173 -15 454 -1 77 378 175 202 185 170 275 313 367 82 407 459 473 507 621 691 707 731 805 825 935 981 52 48 46 -10 -66 -162 -168 -192 -196 -218 -232 -262 -280 -288 -332 -358 -402 -438 -448 -490 -502 -516 -572 -590 -598 -832 -834 ];\r\nvexp=[-891 962 792 -851 784 730 -789 -781 662 662 -765 -737 -713 644 -567 -525 -465 534 -451 526 454 -427 -399 -173 -15 454 -1 77 378 175 202 185 170 275 313 367 82 407 459 473 507 621 691 707 731 805 825 935 981 52 48 46 -10 -66 -162 -168 -192 -196 -218 -232 -262 -280 -288 -332 -358 -402 -438 -448 -490 -502 -516 -572 -590 -598 -832 -834 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[990 988 -999 -995 -993 -993 -991 976 970 958 -989 -973 946 -965 -963 -957 -957 -941 938 -939 -937 -937 -913 -907 -901 938 938 924 -901 -893 924 -891 -889 918 -869 912 910 -869 -869 -845 -827 -811 -793 -741 906 868 -715 -715 844 836 -711 -709 812 -693 -693 -687 -665 808 786 774 -665 -663 -663 -615 -603 -593 -589 770 762 -587 756 -585 -581 -565 -565 -561 -555 -555 -553 -541 706 704 -539 -505 694 -503 -493 -455 -451 672 -427 -399 670 -385 658 -373 -359 656 -339 -335 654 -333 -327 636 -325 -313 -297 -297 -273 616 -263 -253 614 -251 604 590 -219 -209 550 -207 -203 -187 -185 -181 -177 -167 -159 546 -157 -145 -137 544 -135 -105 -77 -71 -67 -65 -41 540 -39 532 528 -37 526 -33 -31 -23 -21 -13 524 11 15 19 520 506 27 37 41 43 494 77 488 89 101 105 127 486 129 131 472 468 458 133 133 139 450 139 171 171 428 175 428 189 203 219 410 237 251 396 255 265 271 273 273 273 293 392 297 376 299 301 315 315 351 373 374 377 377 379 385 387 389 397 407 374 368 409 411 425 433 439 449 451 481 507 535 342 537 553 338 338 575 322 312 577 577 581 583 585 308 306 603 292 264 619 248 242 228 224 623 637 645 220 661 663 208 671 681 204 186 693 693 701 719 721 178 170 737 749 154 763 154 767 154 769 789 154 144 142 130 793 793 795 803 803 805 815 817 819 821 120 823 120 825 86 86 78 74 72 825 62 839 841 861 861 861 873 875 56 875 42 897 935 935 949 12 949 955 955 8 975 979 0 0 0 0 0 -52 -56 -60 -70 -70 -72 -94 -96 -98 -110 -110 -114 -116 -126 -126 -136 -158 -160 -176 -178 -182 -188 -196 -200 -206 -208 -208 -222 -224 -228 -276 -278 -296 -302 -316 -318 -324 -334 -346 -350 -350 -358 -364 -368 -370 -378 -378 -378 -386 -404 -416 -416 -418 -420 -432 -448 -462 -480 -482 -490 -502 -514 -516 -520 -546 -546 -546 -550 -564 -570 -570 -572 -574 -580 -600 -602 -624 -626 -626 -634 -650 -658 -658 -662 -686 -712 -716 -720 -726 -730 -732 -756 -756 -770 -780 -790 -798 -802 -824 -836 -882 -894 -906 -914 -914 -932 -950 -952 -966 -968 -978 -978 -990 -990 ];\r\nvexp=[990 988 -999 -995 -993 -993 -991 976 970 958 -989 -973 946 -965 -963 -957 -957 -941 938 -939 -937 -937 -913 -907 -901 938 938 924 -901 -893 924 -891 -889 918 -869 912 910 -869 -869 -845 -827 -811 -793 -741 906 868 -715 -715 844 836 -711 -709 812 -693 -693 -687 -665 808 786 774 -665 -663 -663 -615 -603 -593 -589 770 762 -587 756 -585 -581 -565 -565 -561 -555 -555 -553 -541 706 704 -539 -505 694 -503 -493 -455 -451 672 -427 -399 670 -385 658 -373 -359 656 -339 -335 654 -333 -327 636 -325 -313 -297 -297 -273 616 -263 -253 614 -251 604 590 -219 -209 550 -207 -203 -187 -185 -181 -177 -167 -159 546 -157 -145 -137 544 -135 -105 -77 -71 -67 -65 -41 540 -39 532 528 -37 526 -33 -31 -23 -21 -13 524 11 15 19 520 506 27 37 41 43 494 77 488 89 101 105 127 486 129 131 472 468 458 133 133 139 450 139 171 171 428 175 428 189 203 219 410 237 251 396 255 265 271 273 273 273 293 392 297 376 299 301 315 315 351 373 374 377 377 379 385 387 389 397 407 374 368 409 411 425 433 439 449 451 481 507 535 342 537 553 338 338 575 322 312 577 577 581 583 585 308 306 603 292 264 619 248 242 228 224 623 637 645 220 661 663 208 671 681 204 186 693 693 701 719 721 178 170 737 749 154 763 154 767 154 769 789 154 144 142 130 793 793 795 803 803 805 815 817 819 821 120 823 120 825 86 86 78 74 72 825 62 839 841 861 861 861 873 875 56 875 42 897 935 935 949 12 949 955 955 8 975 979 0 0 0 0 0 -52 -56 -60 -70 -70 -72 -94 -96 -98 -110 -110 -114 -116 -126 -126 -136 -158 -160 -176 -178 -182 -188 -196 -200 -206 -208 -208 -222 -224 -228 -276 -278 -296 -302 -316 -318 -324 -334 -346 -350 -350 -358 -364 -368 -370 -378 -378 -378 -386 -404 -416 -416 -418 -420 -432 -448 -462 -480 -482 -490 -502 -514 -516 -520 -546 -546 -546 -550 -564 -570 -570 -572 -574 -580 -600 -602 -624 -626 -626 -634 -650 -658 -658 -662 -686 -712 -716 -720 -726 -730 -732 -756 -756 -770 -780 -790 -798 -802 -824 -836 -882 -894 -906 -914 -914 -932 -950 -952 -966 -968 -978 -978 -990 -990 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-997 -995 994 -981 -977 -975 -971 988 -969 -931 -929 986 968 -903 -903 956 -897 -895 -887 -883 948 -879 -871 -871 -865 -863 946 -863 -861 -861 944 -853 934 924 -853 914 914 -847 -845 910 -829 898 -819 890 -807 -807 888 880 -803 -797 880 874 868 -793 860 842 -791 -783 840 -771 838 -767 -765 832 826 -763 826 -759 814 -759 -753 -733 812 -733 -729 -727 -727 -723 804 -715 802 -715 -707 798 -693 -671 -669 -669 -665 792 -663 -663 -663 -663 790 -653 -643 -635 -615 778 774 770 752 -611 -587 -579 746 -569 -569 -561 740 -555 -555 -553 -539 740 -537 -523 728 -517 -513 -509 -505 -497 -497 -493 -483 728 -479 -479 -475 -475 -467 722 722 -439 -431 -429 -425 706 -413 -407 704 702 690 678 676 -407 674 -393 -385 -385 672 670 -385 664 -383 -377 -371 -367 -355 -353 -353 -351 -347 658 -345 656 -327 652 -325 -323 650 616 -319 -315 616 604 602 602 -315 596 594 -313 572 572 566 -311 562 -295 -287 -285 -285 -275 -273 -273 -271 -261 -259 -259 -253 -249 550 -239 542 538 530 -233 -231 -231 -231 526 -217 520 -203 518 -189 518 -187 -183 516 -177 510 508 506 -173 -171 -145 506 504 504 -143 -143 494 492 482 -133 -129 478 474 -129 -125 -113 -111 -99 -93 -91 -81 472 -81 -77 -75 -63 -53 -45 -39 468 462 -39 -39 -13 7 9 13 21 23 35 43 452 43 450 49 49 51 55 67 71 448 73 77 77 81 91 446 93 97 101 105 115 119 121 125 428 151 422 151 171 173 181 187 420 189 195 410 400 392 197 207 211 211 392 221 221 376 376 223 225 364 229 231 231 342 235 241 340 241 336 332 245 326 247 253 322 253 312 255 308 261 269 306 279 291 286 309 286 315 323 266 258 323 329 341 343 256 347 357 379 381 385 397 401 403 403 407 421 427 244 427 429 242 429 433 433 238 433 437 441 234 220 208 443 208 196 451 455 459 467 469 186 182 178 469 475 483 483 505 511 513 539 539 557 559 561 565 168 168 567 166 156 575 156 585 593 154 150 593 148 144 136 130 595 597 597 609 613 617 120 633 637 639 647 661 671 118 114 112 679 110 679 679 110 681 683 687 106 98 98 693 693 695 98 76 699 72 699 713 715 721 64 727 62 731 733 62 56 735 739 741 745 52 749 749 52 28 22 20 759 14 759 763 8 763 765 767 8 6 4 0 0 0 0 0 0 767 767 785 791 801 -2 803 805 -8 -22 819 -24 825 833 -40 839 845 -44 847 847 847 -60 847 865 -64 865 871 909 -84 913 913 915 -84 919 -108 923 -110 929 933 933 -112 939 -114 949 963 965 -142 967 969 973 -144 -150 -156 981 983 987 989 993 995 995 -156 -164 -170 -174 -182 -188 -188 -208 -220 -240 -244 -252 -254 -262 -264 -268 -274 -280 -284 -286 -294 -318 -322 -330 -336 -338 -348 -350 -350 -356 -358 -370 -374 -384 -422 -422 -428 -432 -434 -434 -436 -436 -438 -440 -440 -458 -476 -476 -478 -482 -494 -494 -504 -504 -504 -506 -508 -512 -524 -526 -526 -528 -530 -532 -536 -538 -562 -564 -566 -570 -574 -580 -582 -592 -596 -596 -612 -614 -614 -616 -616 -618 -620 -620 -630 -632 -636 -642 -646 -648 -652 -656 -658 -658 -660 -664 -672 -672 -672 -690 -694 -714 -716 -730 -742 -748 -750 -768 -770 -770 -774 -778 -790 -794 -798 -806 -808 -812 -814 -822 -826 -830 -850 -858 -858 -878 -888 -892 -896 -900 -906 -910 -910 -910 -912 -922 -922 -926 -928 -950 -952 -976 -986 -986 ];\r\nvexp=[-997 -995 994 -981 -977 -975 -971 988 -969 -931 -929 986 968 -903 -903 956 -897 -895 -887 -883 948 -879 -871 -871 -865 -863 946 -863 -861 -861 944 -853 934 924 -853 914 914 -847 -845 910 -829 898 -819 890 -807 -807 888 880 -803 -797 880 874 868 -793 860 842 -791 -783 840 -771 838 -767 -765 832 826 -763 826 -759 814 -759 -753 -733 812 -733 -729 -727 -727 -723 804 -715 802 -715 -707 798 -693 -671 -669 -669 -665 792 -663 -663 -663 -663 790 -653 -643 -635 -615 778 774 770 752 -611 -587 -579 746 -569 -569 -561 740 -555 -555 -553 -539 740 -537 -523 728 -517 -513 -509 -505 -497 -497 -493 -483 728 -479 -479 -475 -475 -467 722 722 -439 -431 -429 -425 706 -413 -407 704 702 690 678 676 -407 674 -393 -385 -385 672 670 -385 664 -383 -377 -371 -367 -355 -353 -353 -351 -347 658 -345 656 -327 652 -325 -323 650 616 -319 -315 616 604 602 602 -315 596 594 -313 572 572 566 -311 562 -295 -287 -285 -285 -275 -273 -273 -271 -261 -259 -259 -253 -249 550 -239 542 538 530 -233 -231 -231 -231 526 -217 520 -203 518 -189 518 -187 -183 516 -177 510 508 506 -173 -171 -145 506 504 504 -143 -143 494 492 482 -133 -129 478 474 -129 -125 -113 -111 -99 -93 -91 -81 472 -81 -77 -75 -63 -53 -45 -39 468 462 -39 -39 -13 7 9 13 21 23 35 43 452 43 450 49 49 51 55 67 71 448 73 77 77 81 91 446 93 97 101 105 115 119 121 125 428 151 422 151 171 173 181 187 420 189 195 410 400 392 197 207 211 211 392 221 221 376 376 223 225 364 229 231 231 342 235 241 340 241 336 332 245 326 247 253 322 253 312 255 308 261 269 306 279 291 286 309 286 315 323 266 258 323 329 341 343 256 347 357 379 381 385 397 401 403 403 407 421 427 244 427 429 242 429 433 433 238 433 437 441 234 220 208 443 208 196 451 455 459 467 469 186 182 178 469 475 483 483 505 511 513 539 539 557 559 561 565 168 168 567 166 156 575 156 585 593 154 150 593 148 144 136 130 595 597 597 609 613 617 120 633 637 639 647 661 671 118 114 112 679 110 679 679 110 681 683 687 106 98 98 693 693 695 98 76 699 72 699 713 715 721 64 727 62 731 733 62 56 735 739 741 745 52 749 749 52 28 22 20 759 14 759 763 8 763 765 767 8 6 4 0 0 0 0 0 0 767 767 785 791 801 -2 803 805 -8 -22 819 -24 825 833 -40 839 845 -44 847 847 847 -60 847 865 -64 865 871 909 -84 913 913 915 -84 919 -108 923 -110 929 933 933 -112 939 -114 949 963 965 -142 967 969 973 -144 -150 -156 981 983 987 989 993 995 995 -156 -164 -170 -174 -182 -188 -188 -208 -220 -240 -244 -252 -254 -262 -264 -268 -274 -280 -284 -286 -294 -318 -322 -330 -336 -338 -348 -350 -350 -356 -358 -370 -374 -384 -422 -422 -428 -432 -434 -434 -436 -436 -438 -440 -440 -458 -476 -476 -478 -482 -494 -494 -504 -504 -504 -506 -508 -512 -524 -526 -526 -528 -530 -532 -536 -538 -562 -564 -566 -570 -574 -580 -582 -592 -596 -596 -612 -614 -614 -616 -616 -618 -620 -620 -630 -632 -636 -642 -646 -648 -652 -656 -658 -658 -660 -664 -672 -672 -672 -690 -694 -714 -716 -730 -742 -748 -750 -768 -770 -770 -774 -778 -790 -794 -798 -806 -808 -812 -814 -822 -826 -830 -850 -858 -858 -878 -888 -892 -896 -900 -906 -910 -910 -910 -912 -922 -922 -926 -928 -950 -952 -976 -986 -986 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-999 -993 -987 -983 -979 998 -975 -975 -973 994 -953 -951 -949 -947 -943 -935 -925 -923 -919 994 -919 -909 -901 986 970 970 966 -897 962 -897 952 -891 950 -885 938 -885 -877 924 916 -869 916 916 906 906 -855 -847 902 -845 -825 -819 898 -819 -815 -813 -813 -805 -803 -799 -797 892 -793 888 -791 -781 884 -779 878 -777 876 -773 -763 -763 872 870 -759 -757 870 862 -753 -749 -747 858 -745 854 -741 -737 -737 -735 -731 -727 -727 -721 -715 854 -715 -713 836 -711 -709 -709 -699 832 824 -693 -689 -689 822 818 816 -689 -689 -687 -683 -679 -677 812 -671 -671 802 -667 798 798 796 786 -667 -643 784 -637 -637 784 -637 -637 782 774 -635 -627 -615 -611 -609 -595 770 -595 766 -585 760 758 754 -573 -559 -559 -547 -531 744 -517 -517 -515 -511 744 -505 738 -495 -493 738 -455 -455 -439 738 -439 -435 734 -431 734 -429 -423 728 728 728 -411 -407 728 -403 -403 728 -401 706 -401 704 -395 -389 700 -385 700 -375 694 -375 -373 -369 692 -359 -351 -351 -341 -337 -335 -329 -327 -309 -301 -297 -297 -295 -289 686 -285 676 -281 -275 -273 674 670 668 -253 658 -253 -247 656 -241 -237 650 -235 -235 648 -227 644 644 -223 -221 -211 -209 638 626 -195 -189 -175 -169 624 624 622 -163 616 -155 -155 616 602 -143 -143 -137 -115 -99 -99 -95 -91 -89 594 -85 -75 -73 -63 -55 592 -49 592 572 -39 -37 572 570 -33 -23 568 -21 -3 564 -1 564 -1 562 560 558 -1 546 13 13 542 19 27 31 49 532 69 77 83 528 85 91 91 97 101 105 498 119 125 127 498 129 131 137 139 143 145 149 151 165 494 165 169 175 195 201 490 203 209 486 484 211 211 480 217 221 225 476 231 239 239 239 472 464 239 245 253 464 259 462 259 462 273 462 273 279 287 287 291 291 307 311 462 313 317 319 321 325 331 341 343 351 359 365 369 373 375 462 377 448 385 385 448 389 440 391 438 407 411 413 429 435 432 441 441 445 447 432 428 451 451 457 418 459 467 471 416 414 475 386 483 485 495 495 497 499 507 517 382 380 521 525 368 360 356 525 527 336 318 531 531 312 308 292 286 539 268 266 539 559 567 571 264 262 260 571 577 581 585 593 595 252 595 605 609 611 611 611 252 613 248 621 244 242 238 621 623 623 623 234 627 234 627 627 234 639 234 643 645 647 649 649 651 651 226 653 675 679 224 685 689 220 689 689 697 214 705 705 206 707 709 711 715 725 200 735 735 198 737 741 196 196 749 753 196 753 759 194 771 777 777 787 789 178 799 803 811 813 176 174 815 815 158 154 819 827 827 833 841 845 847 847 154 851 851 859 154 861 861 863 867 154 875 154 885 887 891 154 895 154 895 907 909 913 915 154 917 148 921 923 136 931 130 937 130 118 949 957 957 961 112 963 110 110 971 979 102 979 98 98 92 88 985 987 84 84 76 66 56 46 42 42 42 40 28 24 14 0 0 0 0 -2 -6 -26 -26 -26 -34 -34 -42 -42 -42 -44 -52 -58 -92 -94 -98 -100 -108 -110 -120 -126 -126 -134 -142 -144 -146 -150 -154 -154 -154 -154 -156 -156 -158 -174 -176 -182 -196 -228 -252 -252 -260 -264 -266 -266 -278 -278 -282 -286 -290 -296 -304 -310 -312 -316 -320 -326 -330 -334 -340 -342 -346 -348 -352 -362 -364 -374 -378 -382 -386 -388 -390 -392 -396 -404 -406 -406 -412 -414 -418 -426 -428 -432 -438 -442 -450 -462 -464 -468 -468 -472 -476 -486 -490 -492 -518 -520 -526 -526 -532 -532 -534 -546 -546 -546 -546 -548 -550 -560 -566 -572 -578 -580 -596 -596 -598 -614 -616 -620 -622 -640 -660 -664 -670 -672 -676 -686 -696 -698 -698 -702 -708 -726 -728 -728 -742 -750 -752 -754 -754 -764 -770 -770 -780 -784 -788 -792 -794 -806 -806 -818 -820 -822 -822 -824 -830 -852 -862 -864 -868 -868 -868 -872 -878 -896 -902 -906 -910 -910 -914 -922 -924 -924 -924 -924 -926 -936 -936 -938 -940 -956 -958 -962 -968 -988 -994 -994 -994 -994 -1000 ];\r\nvexp=[-999 -993 -987 -983 -979 998 -975 -975 -973 994 -953 -951 -949 -947 -943 -935 -925 -923 -919 994 -919 -909 -901 986 970 970 966 -897 962 -897 952 -891 950 -885 938 -885 -877 924 916 -869 916 916 906 906 -855 -847 902 -845 -825 -819 898 -819 -815 -813 -813 -805 -803 -799 -797 892 -793 888 -791 -781 884 -779 878 -777 876 -773 -763 -763 872 870 -759 -757 870 862 -753 -749 -747 858 -745 854 -741 -737 -737 -735 -731 -727 -727 -721 -715 854 -715 -713 836 -711 -709 -709 -699 832 824 -693 -689 -689 822 818 816 -689 -689 -687 -683 -679 -677 812 -671 -671 802 -667 798 798 796 786 -667 -643 784 -637 -637 784 -637 -637 782 774 -635 -627 -615 -611 -609 -595 770 -595 766 -585 760 758 754 -573 -559 -559 -547 -531 744 -517 -517 -515 -511 744 -505 738 -495 -493 738 -455 -455 -439 738 -439 -435 734 -431 734 -429 -423 728 728 728 -411 -407 728 -403 -403 728 -401 706 -401 704 -395 -389 700 -385 700 -375 694 -375 -373 -369 692 -359 -351 -351 -341 -337 -335 -329 -327 -309 -301 -297 -297 -295 -289 686 -285 676 -281 -275 -273 674 670 668 -253 658 -253 -247 656 -241 -237 650 -235 -235 648 -227 644 644 -223 -221 -211 -209 638 626 -195 -189 -175 -169 624 624 622 -163 616 -155 -155 616 602 -143 -143 -137 -115 -99 -99 -95 -91 -89 594 -85 -75 -73 -63 -55 592 -49 592 572 -39 -37 572 570 -33 -23 568 -21 -3 564 -1 564 -1 562 560 558 -1 546 13 13 542 19 27 31 49 532 69 77 83 528 85 91 91 97 101 105 498 119 125 127 498 129 131 137 139 143 145 149 151 165 494 165 169 175 195 201 490 203 209 486 484 211 211 480 217 221 225 476 231 239 239 239 472 464 239 245 253 464 259 462 259 462 273 462 273 279 287 287 291 291 307 311 462 313 317 319 321 325 331 341 343 351 359 365 369 373 375 462 377 448 385 385 448 389 440 391 438 407 411 413 429 435 432 441 441 445 447 432 428 451 451 457 418 459 467 471 416 414 475 386 483 485 495 495 497 499 507 517 382 380 521 525 368 360 356 525 527 336 318 531 531 312 308 292 286 539 268 266 539 559 567 571 264 262 260 571 577 581 585 593 595 252 595 605 609 611 611 611 252 613 248 621 244 242 238 621 623 623 623 234 627 234 627 627 234 639 234 643 645 647 649 649 651 651 226 653 675 679 224 685 689 220 689 689 697 214 705 705 206 707 709 711 715 725 200 735 735 198 737 741 196 196 749 753 196 753 759 194 771 777 777 787 789 178 799 803 811 813 176 174 815 815 158 154 819 827 827 833 841 845 847 847 154 851 851 859 154 861 861 863 867 154 875 154 885 887 891 154 895 154 895 907 909 913 915 154 917 148 921 923 136 931 130 937 130 118 949 957 957 961 112 963 110 110 971 979 102 979 98 98 92 88 985 987 84 84 76 66 56 46 42 42 42 40 28 24 14 0 0 0 0 -2 -6 -26 -26 -26 -34 -34 -42 -42 -42 -44 -52 -58 -92 -94 -98 -100 -108 -110 -120 -126 -126 -134 -142 -144 -146 -150 -154 -154 -154 -154 -156 -156 -158 -174 -176 -182 -196 -228 -252 -252 -260 -264 -266 -266 -278 -278 -282 -286 -290 -296 -304 -310 -312 -316 -320 -326 -330 -334 -340 -342 -346 -348 -352 -362 -364 -374 -378 -382 -386 -388 -390 -392 -396 -404 -406 -406 -412 -414 -418 -426 -428 -432 -438 -442 -450 -462 -464 -468 -468 -472 -476 -486 -490 -492 -518 -520 -526 -526 -532 -532 -534 -546 -546 -546 -546 -548 -550 -560 -566 -572 -578 -580 -596 -596 -598 -614 -616 -620 -622 -640 -660 -664 -670 -672 -676 -686 -696 -698 -698 -702 -708 -726 -728 -728 -742 -750 -752 -754 -754 -764 -770 -770 -780 -784 -788 -792 -794 -806 -806 -818 -820 -822 -822 -824 -830 -852 -862 -864 -868 -868 -868 -872 -878 -896 -902 -906 -910 -910 -914 -922 -924 -924 -924 -924 -926 -936 -936 -938 -940 -956 -958 -962 -968 -988 -994 -994 -994 -994 -1000 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[994 -969 988 986 -957 -931 966 -889 -889 -883 -881 -877 -877 960 -873 914 -861 912 -847 -845 -841 -835 900 -805 -803 -793 -793 886 864 -785 -765 -765 -737 -713 -713 -701 -661 -655 -621 840 -619 -615 -599 832 -595 -567 -553 828 -541 -497 -467 -455 -429 -419 -415 -387 794 -377 792 -375 -371 -365 -337 -333 -331 -321 -285 780 -285 762 -271 -263 758 -259 -257 732 728 -249 -235 -231 -231 -189 726 -189 -181 -175 698 -153 -149 696 684 -127 672 -119 -115 652 -115 -113 644 -93 -91 608 -91 602 -77 -49 -45 594 -35 -5 562 -3 11 540 538 518 506 41 43 506 57 111 121 474 123 161 177 191 203 207 217 217 247 259 269 273 468 464 442 297 303 319 321 333 343 349 420 418 353 410 397 406 427 384 427 429 384 455 455 467 378 370 493 505 364 525 364 533 348 336 539 541 583 589 611 330 316 619 627 647 651 681 717 719 308 725 739 757 767 282 777 274 779 797 847 264 262 252 853 873 242 933 947 969 971 979 232 208 182 999 999 174 170 138 132 126 110 108 98 98 70 44 44 22 4 0 0 0 -2 -22 -58 -66 -74 -94 -116 -148 -158 -182 -210 -214 -222 -226 -238 -248 -252 -256 -286 -310 -320 -336 -342 -370 -388 -402 -402 -416 -440 -440 -458 -460 -460 -490 -504 -514 -528 -560 -572 -588 -596 -600 -616 -638 -642 -654 -660 -676 -684 -702 -706 -708 -720 -726 -742 -746 -766 -786 -812 -832 -840 -846 -864 -910 -912 -916 -948 -966 -982 -986 -992 ];\r\nvexp=[994 -969 988 986 -957 -931 966 -889 -889 -883 -881 -877 -877 960 -873 914 -861 912 -847 -845 -841 -835 900 -805 -803 -793 -793 886 864 -785 -765 -765 -737 -713 -713 -701 -661 -655 -621 840 -619 -615 -599 832 -595 -567 -553 828 -541 -497 -467 -455 -429 -419 -415 -387 794 -377 792 -375 -371 -365 -337 -333 -331 -321 -285 780 -285 762 -271 -263 758 -259 -257 732 728 -249 -235 -231 -231 -189 726 -189 -181 -175 698 -153 -149 696 684 -127 672 -119 -115 652 -115 -113 644 -93 -91 608 -91 602 -77 -49 -45 594 -35 -5 562 -3 11 540 538 518 506 41 43 506 57 111 121 474 123 161 177 191 203 207 217 217 247 259 269 273 468 464 442 297 303 319 321 333 343 349 420 418 353 410 397 406 427 384 427 429 384 455 455 467 378 370 493 505 364 525 364 533 348 336 539 541 583 589 611 330 316 619 627 647 651 681 717 719 308 725 739 757 767 282 777 274 779 797 847 264 262 252 853 873 242 933 947 969 971 979 232 208 182 999 999 174 170 138 132 126 110 108 98 98 70 44 44 22 4 0 0 0 -2 -22 -58 -66 -74 -94 -116 -148 -158 -182 -210 -214 -222 -226 -238 -248 -252 -256 -286 -310 -320 -336 -342 -370 -388 -402 -402 -416 -440 -440 -458 -460 -460 -490 -504 -514 -528 -560 -572 -588 -596 -600 -616 -638 -642 -654 -660 -676 -684 -702 -706 -708 -720 -726 -742 -746 -766 -786 -812 -832 -840 -846 -864 -910 -912 -916 -948 -966 -982 -986 -992 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-991 -989 998 -987 -983 -973 996 982 980 -971 978 -965 -959 974 -957 -951 -947 966 -941 966 966 962 -931 -931 -909 -903 -895 -893 -889 -885 -883 944 -883 936 -869 912 -845 896 894 -845 -837 -833 -829 886 882 -817 880 -803 872 -791 -791 -777 -769 -765 -759 -753 870 -743 -729 864 -717 864 854 -711 -707 850 -695 -689 -683 840 826 -665 -661 -659 812 798 -659 766 -657 760 -653 -637 756 -631 -627 -621 -611 748 -609 -605 -605 -601 -597 -589 -573 -567 -541 -539 -539 740 730 -539 -535 -507 -483 728 -475 -469 714 -455 -453 710 704 -451 -447 -433 -433 -431 -421 -417 -417 686 -405 682 -403 680 -399 678 -391 672 -387 670 668 -385 660 -381 -381 636 -377 -367 -363 -353 -331 626 618 -325 -303 616 -299 -297 -291 584 -281 -277 578 578 572 570 -245 -243 -239 -231 -223 -221 -209 570 -205 -201 -185 -183 -175 -165 -163 -159 -157 568 -147 564 -139 562 -125 548 -117 544 542 -103 -101 528 -95 524 -95 -79 -71 -71 -61 -49 520 -41 -37 520 518 -33 -27 502 -25 490 -21 482 474 -17 474 -17 -9 -7 -7 7 13 15 446 17 23 446 31 35 440 35 39 45 49 49 426 59 418 406 67 91 404 93 103 388 105 107 113 388 117 119 121 123 131 141 143 143 161 173 173 179 378 195 358 197 203 231 257 356 263 271 273 275 277 287 297 338 301 303 338 305 323 325 336 330 369 381 399 322 308 407 308 413 308 296 419 419 296 425 439 292 445 280 451 451 260 451 453 246 469 469 469 483 246 495 242 501 242 511 517 232 212 529 539 206 180 178 539 178 549 549 553 559 561 561 565 567 573 585 585 595 607 623 633 641 657 683 689 719 727 733 735 741 759 168 779 783 166 164 791 807 817 819 823 861 865 869 869 162 903 907 138 907 913 913 917 923 132 132 941 130 953 957 126 122 965 971 981 985 993 995 104 98 98 94 88 88 86 80 78 76 68 66 66 60 58 52 36 36 22 16 0 0 0 -14 -20 -22 -26 -28 -52 -54 -56 -58 -70 -70 -72 -76 -118 -126 -126 -140 -140 -142 -154 -154 -168 -172 -174 -182 -188 -196 -196 -206 -208 -220 -220 -222 -226 -236 -262 -286 -300 -308 -308 -322 -322 -336 -342 -346 -366 -396 -396 -404 -444 -446 -450 -462 -462 -466 -468 -468 -486 -486 -490 -498 -498 -506 -520 -532 -546 -548 -588 -594 -594 -596 -596 -604 -608 -612 -616 -616 -616 -622 -622 -626 -626 -656 -656 -656 -664 -672 -680 -682 -682 -714 -718 -744 -750 -750 -756 -770 -788 -800 -806 -814 -816 -850 -858 -858 -864 -868 -868 -870 -882 -884 -910 -924 -928 -932 -942 -946 -950 -952 -980 -986 -988 ];\r\nvexp=[-991 -989 998 -987 -983 -973 996 982 980 -971 978 -965 -959 974 -957 -951 -947 966 -941 966 966 962 -931 -931 -909 -903 -895 -893 -889 -885 -883 944 -883 936 -869 912 -845 896 894 -845 -837 -833 -829 886 882 -817 880 -803 872 -791 -791 -777 -769 -765 -759 -753 870 -743 -729 864 -717 864 854 -711 -707 850 -695 -689 -683 840 826 -665 -661 -659 812 798 -659 766 -657 760 -653 -637 756 -631 -627 -621 -611 748 -609 -605 -605 -601 -597 -589 -573 -567 -541 -539 -539 740 730 -539 -535 -507 -483 728 -475 -469 714 -455 -453 710 704 -451 -447 -433 -433 -431 -421 -417 -417 686 -405 682 -403 680 -399 678 -391 672 -387 670 668 -385 660 -381 -381 636 -377 -367 -363 -353 -331 626 618 -325 -303 616 -299 -297 -291 584 -281 -277 578 578 572 570 -245 -243 -239 -231 -223 -221 -209 570 -205 -201 -185 -183 -175 -165 -163 -159 -157 568 -147 564 -139 562 -125 548 -117 544 542 -103 -101 528 -95 524 -95 -79 -71 -71 -61 -49 520 -41 -37 520 518 -33 -27 502 -25 490 -21 482 474 -17 474 -17 -9 -7 -7 7 13 15 446 17 23 446 31 35 440 35 39 45 49 49 426 59 418 406 67 91 404 93 103 388 105 107 113 388 117 119 121 123 131 141 143 143 161 173 173 179 378 195 358 197 203 231 257 356 263 271 273 275 277 287 297 338 301 303 338 305 323 325 336 330 369 381 399 322 308 407 308 413 308 296 419 419 296 425 439 292 445 280 451 451 260 451 453 246 469 469 469 483 246 495 242 501 242 511 517 232 212 529 539 206 180 178 539 178 549 549 553 559 561 561 565 567 573 585 585 595 607 623 633 641 657 683 689 719 727 733 735 741 759 168 779 783 166 164 791 807 817 819 823 861 865 869 869 162 903 907 138 907 913 913 917 923 132 132 941 130 953 957 126 122 965 971 981 985 993 995 104 98 98 94 88 88 86 80 78 76 68 66 66 60 58 52 36 36 22 16 0 0 0 -14 -20 -22 -26 -28 -52 -54 -56 -58 -70 -70 -72 -76 -118 -126 -126 -140 -140 -142 -154 -154 -168 -172 -174 -182 -188 -196 -196 -206 -208 -220 -220 -222 -226 -236 -262 -286 -300 -308 -308 -322 -322 -336 -342 -346 -366 -396 -396 -404 -444 -446 -450 -462 -462 -466 -468 -468 -486 -486 -490 -498 -498 -506 -520 -532 -546 -548 -588 -594 -594 -596 -596 -604 -608 -612 -616 -616 -616 -622 -622 -626 -626 -656 -656 -656 -664 -672 -680 -682 -682 -714 -718 -744 -750 -750 -756 -770 -788 -800 -806 -814 -816 -850 -858 -858 -864 -868 -868 -870 -882 -884 -910 -924 -928 -932 -942 -946 -950 -952 -980 -986 -988 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-295 -303 -181 -373 3 955 107 217 -418 89 37 186 29 -19 -459 -780 -990 -971 673 821 820 403 317 -844 104 187 403 910 897 -684 -440 259 555 -773 -28 -509 559 507 546 -394 602 889 -602 -945 717 -503 -931 56 5 -913 965 927 980 926 -255 960 -385 539 546 -187 -504 -138 -673 443 955 913 335 -902 -814 -182 564 -335 676 813 394 945 -234 -181 -445 11 -463 693 -346 -778 -383 -724 747 227 -554 897 -495 -139 623 98 -217 -845 153 461 298 -689 487 -466 698 -159 -569 439 786 80 -751 -366 259 528 955 704 -313 71 468 -9 -341 277 315 966 999 -138 -449 -869 636 951 -266 -417 -127 -429 385 -406 -395 -75 -802 -929 -377 -290 882 -554 -529 233 -979 830 330 -737 845 309 670 -415 341 339 479 -550 -139 -47 -357 627 351 320 39 -291 182 -956 882 455 -308 781 -151 -349 33 -506 149 -325 315 -895 273 943 143 -357 -968 -923 163 526 446 -505 -497 59 -580 -89 -161 -39 777 671 832 -939 -185 263 -473 -321 514 -351 -276 294 231 699 -429 899 29 -678 -402 -958 -88 938 -80 285 -553 203 925 -790 471 -684 271 420 -559 -15 -582 -81 22 600 -903 455 -285 914 -382 -692 319 -986 363 -23 795 253 -257 -467 211 -908 -559 845 -478 687 -515 387 134 931 203 -7 303 572 737 669 945 -547 379 911 -117 882 704 454 -269 -488 756 -567 -125 -59 715 265 147 429 243 574 -197 -523 -462 -987 937 -305 347 394 462 373 517 -673 640 532 -720 32 185 -821 -749 -727 106 308 -572 721 -34 -803 -613 537 836 -489 -658 168 331 -368 871 -602 399 992 729 -325 -173 -765 -793 -901 -728 -109 -705 -40 -825 972 -46 884 76 471 -814 -753 -169 837 -499 381 178 -363 509 -847 -855 359 65 149 -481 -468 89 417 814 -358 -357 5 91 -924 -738 765 -15 -881 -634 -303 -769 -105 225 -245 -109 -437 -165 625 704 964 539 659 -357 -373 889 173 825 -963 -627 -529 -700 537 851 6 273 -637 -840 -576 -343 -992 9 145 551 -447 870 286 88 -850 440 661 -729 -279 556 588 870 -110 -723 429 -759 -616 361 815 60 861 -522 -29 455 -91 -917 -781 -469 -89 406 -231 -569 289 -84 -847 -199 912 64 748 389 781 -224 -525 -504 287 -605 559 722 -775 -879 991 689 721 -504 -362 988 99 949 202 -931 -920 -284 -213 616 581 847 495 363 -418 608 49 -832 157 763 -203 -581 -689 -632 -231 -91 376 -309 -352 672 253 -301 418 885 85 321 812 501 -79 366 -249 -175 65 737 -849 -453 871 -468 868 919 952 425 351 -935 -301 -595 372 -155 -21 913 50 597 548 825 299 465 -501 249 -583 734 -983 -224 19 -218 476 -364 392 211 580 717 557 942 255 972 -88 -420 -763 -438 -721 351 -289 661 -741 904 -949 -954 -103 858 155 -251 -245 429 -149 -752 657 -781 -583 -224 -202 -771 525 442 978 -13 681 430 198 -623 937 -897 -910 -155 708 -383 -800 169 981 -910 7 -896 -544 633 -812 533 462 482 22 -231 251 415 -450 631 -631 234 -23 622 19 -175 -160 -638 868 -112 119 -203 671 520 490 273 -857 -842 -499 721 -77 273 993 181 910 -922 -421 -728 -627 -451 -279 -739 607 -839 -444 -910 56 -740 -715 923 -344 -825 -91 -690 728 -429 -104 393 -270 -788 -585 -507 -44 -663 905 -589 801 -681 473 430 -247 -957 468 676 -726 99 543 -179 314 96 283 -285 -871 15 759 545 510 437 123 -689 171 -335 -580 -403 -154 741 782 -416 857 -307 346 325 -109 -929 -325 -618 -243 -377 -231 370 -197 -598 -668 735 553 -506 -616 -90 119 -235 -853 -248 -313 65 136 -305 -476 -350 459 888 347 651 -737 -775 211 567 809 -411 -634 -178 92 -702 741 449 -703 -608 -438 -199 180 -978 -957 -308 -883 -993 -357 -845 -429 938 -367 679 912 755 233 -589 983 -537 523 975 -775 -754 -855 -676 295 651 -327 624 -514 -572 -906 150 504 24 946 552 834 -256 252 374 882 368 -920 -828 -696 -274 -294 898 -664 616 932 966 -728 86 912 -640 -636 -428 -364 470 -922 570 326 -206 -514 188 96 -412 -472 702 -156 -682 188 -462 560 -350 426 -2 -818 774 0 436 280 712 302 -26 -352 224 -290 -24 -630 -746 -418 692 -294 252 238 178 214 -858 -196 -672 846 968 0 972 312 700 -804 -858 -284 -690 216 -660 -210 504 -280 -822 -138 276 -438 -104 442 240 352 -252 460 -246 -180 66 -574 60 -922 760 -934 -86 -922 -82 -82 374 -84 158 242 216 530 -628 -386 -876 974 630 -528 -682 402 -242 752 -74 -704 98 462 344 252 800 920 -70 -994 -628 -220 852 -768 -282 -890 634 14 -266 848 428 580 -288 308 650 -518 -700 434 -872 -146 -950 500 -132 -254 -810 316 -376 580 630 -300 -688 242 46 -224 38 -716 12 84 642 -766 -992 -730 -568 1000 542 422 190 -744 796 -594 442 -938 616 -512 724 -72 -522 536 224 -804 252 32 704 -892 -728 806 -28 112 592 346 -256 210 -610 -374 872 918 102 -616 668 84 -546 -836 584 456 -810 -380 -910 420 -540 14 -628 -286 -40 -504 -224 686 890 -902 -294 -448 -672 198 ];\r\nvexp=[-993 -987 -983 -979 -971 -963 -957 -957 1000 -949 -945 992 -939 -935 -931 988 980 -931 -929 -929 978 -923 -917 974 972 -913 -903 972 -901 972 968 -897 -895 -883 966 -881 -879 -871 966 964 960 -869 952 -857 -855 -855 -853 946 -849 -847 -847 -845 942 938 -845 938 -839 -825 932 -825 926 920 -821 -803 -793 -781 -781 918 914 912 912 -775 912 -775 910 -775 910 -773 -771 -769 -765 -763 904 898 -759 890 -753 -751 888 -749 -741 -739 -737 884 -737 -729 -727 -723 882 -721 -715 882 882 -705 -703 -689 882 872 -689 870 -689 870 -681 868 -673 -673 868 -663 -637 -631 -627 858 -627 852 -623 -613 848 -605 846 -595 -589 -589 -585 836 -583 -583 834 -581 -569 832 830 820 -569 -567 -559 814 812 -559 -553 -547 806 -537 -529 -529 -525 800 -523 -515 -509 -507 -505 796 -503 -501 786 782 774 -499 760 -499 -497 -495 -489 756 -481 -473 -469 -467 -463 -459 -453 -451 752 -449 -447 748 734 -445 -437 -429 728 -429 -429 -429 -421 -417 724 -415 -411 -403 -395 -385 722 -383 712 708 -383 -377 -377 -373 -373 704 704 704 704 702 700 -367 -363 -357 -357 698 -357 692 -357 686 -357 -351 676 -349 676 672 -343 -341 -335 670 668 650 -335 642 -327 -325 -325 -325 -321 -313 -313 640 -309 -307 636 -305 -305 -303 634 -303 -301 -301 -295 630 -291 -289 -285 -285 -279 -279 -269 630 624 622 -257 616 616 -255 -251 -249 -247 -245 -245 -243 -235 616 -231 -231 608 -231 -231 -217 -213 602 600 -203 -203 -199 592 588 584 580 -199 -197 -197 -187 580 580 574 -185 572 -181 -181 -179 570 -175 564 560 -175 556 -173 552 -169 548 -165 -161 -159 -155 -155 -151 546 -149 -139 546 -139 542 536 532 530 -127 528 -125 -117 -109 -109 -109 526 -105 -103 -91 -91 -91 -89 -89 -81 520 -79 -77 514 510 -75 -59 -47 504 504 -39 -29 -23 500 -23 -21 -19 -15 -15 -13 -9 -7 3 490 482 5 5 7 9 11 15 19 19 29 29 476 33 37 470 39 49 468 468 59 462 65 65 65 71 462 462 460 456 454 85 89 89 446 442 442 442 91 99 99 440 107 119 436 119 434 123 143 145 147 149 149 153 430 155 157 163 430 169 171 428 426 422 173 181 420 185 420 187 203 203 418 211 211 211 217 225 406 402 394 227 231 394 233 392 376 233 374 243 249 251 253 374 372 253 370 255 259 259 263 265 368 271 273 366 273 352 346 273 273 346 277 283 285 344 287 289 330 295 299 303 309 315 315 317 326 320 319 316 321 325 331 335 339 314 341 347 347 312 351 308 351 351 359 361 363 363 308 373 302 379 298 294 286 280 381 276 385 387 252 389 252 252 252 393 242 399 403 403 415 417 242 425 240 429 238 429 429 437 439 443 234 449 455 455 224 224 455 459 216 216 461 465 214 210 471 471 473 202 479 198 487 198 495 501 190 507 188 188 509 186 517 182 180 178 523 525 533 178 537 537 168 539 158 539 543 150 136 134 112 545 551 553 106 104 555 557 102 559 559 567 581 597 607 98 98 623 96 625 627 631 633 651 651 96 92 88 86 657 659 84 661 661 84 80 669 76 671 66 64 671 673 60 679 681 687 689 693 699 60 715 717 56 56 50 717 721 721 46 38 721 729 735 737 737 741 32 741 747 755 759 763 32 765 24 777 22 22 781 781 14 795 801 809 813 14 815 821 825 12 825 6 0 837 845 0 -2 -24 845 847 851 -26 857 861 -28 871 -28 -34 871 -40 885 889 889 897 897 899 905 911 -40 -44 -46 -70 913 913 919 -72 -74 923 -80 -82 925 -82 927 931 937 937 943 -84 945 945 -84 949 951 955 955 955 965 975 981 -86 983 -88 991 993 999 -88 -90 -104 -104 -110 -112 -132 -138 -138 -138 -146 -154 -156 -160 -178 -180 -182 -196 -202 -206 -210 -218 -220 -224 -224 -224 -224 -224 -234 -242 -246 -248 -252 -254 -256 -256 -266 -266 -270 -274 -276 -280 -282 -284 -284 -286 -288 -290 -290 -294 -294 -294 -300 -308 -308 -344 -346 -350 -350 -352 -352 -358 -362 -364 -364 -366 -368 -374 -376 -380 -382 -386 -394 -402 -406 -412 -416 -418 -418 -418 -420 -428 -438 -438 -438 -440 -444 -448 -450 -462 -462 -466 -468 -468 -472 -476 -478 -488 -504 -504 -504 -504 -506 -506 -512 -514 -514 -518 -522 -522 -528 -540 -544 -546 -550 -554 -554 -568 -572 -572 -574 -576 -580 -580 -582 -594 -598 -602 -602 -608 -610 -616 -616 -616 -618 -628 -628 -628 -630 -632 -634 -634 -636 -638 -640 -658 -660 -664 -668 -672 -672 -676 -678 -682 -682 -684 -684 -688 -690 -690 -692 -696 -700 -700 -702 -704 -716 -720 -724 -726 -728 -728 -728 -728 -730 -738 -740 -744 -746 -752 -754 -766 -768 -778 -780 -788 -790 -800 -802 -804 -804 -810 -810 -812 -814 -814 -818 -822 -828 -832 -836 -840 -842 -844 -850 -858 -858 -872 -876 -890 -892 -896 -902 -902 -906 -908 -910 -910 -910 -910 -920 -920 -922 -922 -922 -922 -924 -934 -938 -950 -954 -956 -958 -968 -978 -986 -990 -992 -992 -994 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":"2013-09-26T04:17:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-26T04:12:00.000Z","updated_at":"2026-01-22T14:04:54.000Z","published_at":"2013-09-26T04:14:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2014 China Sorting\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Subset of cases.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Vout a sorted vector Odds Increasing/Evens Increasing\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eV= [-5 -12 87 2 88 20 11]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eVout=[-5 88 11 20 2 -12 87]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eContest Performance:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Time to Complete: \u0026lt; 10 minutes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46573,"title":"Determine the winner of a goofy golf tournament","description":"My brother and father were playing golf one day, and they caught up to a group that was part of a tournament. The group members explained that the tournament's rules were unconventional:\r\nThe golfer with the best score must have cheated, so that person is eliminated.\r\nThe golfer with the second-best score must have choked (definition, example), so that person is eliminated.\r\nTherefore, the golfer with the third-best score wins.\r\nWrite a function that takes a vector of scores and determines the winner of this tournament (i.e., the number of the golfer with the third-best score). Remember that the objective in golf is to get a low score. You can assume that if two golfers tie for the best score, a playoff would separate them, and the player with the original second lowest score would win. If two golfers tie for the second-best score, eliminate them both. Let's ignore the possibility of a tie for third-best score; the organizers of the tournament probably had everyone figure it out at the 19th hole. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 239.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 119.75px; transform-origin: 407px 119.75px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 375.217px 8px; transform-origin: 375.217px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eMy brother and father were playing golf one day, and they caught up to a group that was part of a tournament. The group members explained that the tournament's rules were unconventional:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 62.5px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 31.25px; transform-origin: 391px 31.25px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.8333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4167px; text-align: left; transform-origin: 363px 10.4167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 243.875px 8px; transform-origin: 243.875px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe golfer with the best score must have cheated, so that person is eliminated.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.8333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4167px; text-align: left; transform-origin: 363px 10.4167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 179.7px 8px; transform-origin: 179.7px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe golfer with the second-best score must have choked (\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Choke_(sports)\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003edefinition\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 3.88333px 8px; transform-origin: 3.88333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=A24tAToTxLU\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eexample\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 93.35px 8px; transform-origin: 93.35px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e), so that person is eliminated.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.8333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.4167px; text-align: left; transform-origin: 363px 10.4167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 157.525px 8px; transform-origin: 157.525px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTherefore, the golfer with the third-best score wins.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.025px 8px; transform-origin: 374.025px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector of scores and determines the winner of this tournament (i.e., the number of the golfer with the third-best score). Remember that the objective in golf is to get a \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 10.5083px 8px; transform-origin: 10.5083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003elow\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 140.533px 8px; transform-origin: 140.533px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e score. You can assume that if two golfers tie for the best score, a playoff would separate them, and the player with the original second lowest score would win. If two golfers tie for the second-best score, eliminate them both. Let's ignore the possibility of a tie for third-best score; the organizers of the tournament probably had everyone figure it out at the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Nineteenth_hole\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e19th hole\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 8px; transform-origin: 3.88333px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function winner = goofyTournament(x)\r\n  winner = min(x);  % Variable winner = number of the golfer with third-best score\r\nend","test_suite":"%%\r\nx = [81 78 68 71 74 86 77 76];\r\nwinner_correct = 5;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = [72 74 75 65 67 70 71 80 78 79 80 71];\r\nwinner_correct = 6;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = [85 83 81 79 77 67 66 72 73 74 71 82];\r\nwinner_correct = 11;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = [71 68 70 78 75 73 70 70 72 72 75 72];\r\nwinner_correct = 1;\r\nassert(isequal(goofyTournament(x),winner_correct))\r\n\r\n%%\r\nx = 67+randperm(20);\r\nwinner_correct = find(x==70);\r\nassert(isequal(goofyTournament(x),winner_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":46909,"edited_at":"2023-09-09T15:55:11.000Z","deleted_by":null,"deleted_at":null,"solvers_count":21,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-06T18:02:51.000Z","updated_at":"2026-01-21T13:56:55.000Z","published_at":"2020-09-06T18:46:03.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMy brother and father were playing golf one day, and they caught up to a group that was part of a tournament. The group members explained that the tournament's rules were unconventional:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe golfer with the best score must have cheated, so that person is eliminated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe golfer with the second-best score must have choked (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Choke_(sports)\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edefinition\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=A24tAToTxLU\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eexample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e), so that person is eliminated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTherefore, the golfer with the third-best score wins.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector of scores and determines the winner of this tournament (i.e., the number of the golfer with the third-best score). Remember that the objective in golf is to get a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003elow\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e score. You can assume that if two golfers tie for the best score, a playoff would separate them, and the player with the original second lowest score would win. If two golfers tie for the second-best score, eliminate them both. Let's ignore the possibility of a tie for third-best score; the organizers of the tournament probably had everyone figure it out at the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Nineteenth_hole\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e19th hole\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44443,"title":"Matrix to vector transformation","description":"given a matrix, make in the output 1 column vector putting odd numbers in ascending order after that put the even numbers in descending order.\r\n*Note* :no repeated numbers in the output. Example\r\n  \r\n\r\n  x=   1     2     3\r\n       4     5     6\r\n       7     8     9\r\n\r\n  y=   1\r\n       3\r\n       5\r\n       7\r\n       9\r\n       8\r\n       6\r\n       4\r\n       2","description_html":"\u003cp\u003egiven a matrix, make in the output 1 column vector putting odd numbers in ascending order after that put the even numbers in descending order. \u003cb\u003eNote\u003c/b\u003e :no repeated numbers in the output. Example\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex=   1     2     3\r\n     4     5     6\r\n     7     8     9\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ey=   1\r\n     3\r\n     5\r\n     7\r\n     9\r\n     8\r\n     6\r\n     4\r\n     2\r\n\u003c/pre\u003e","function_template":"function y = vectorizeit(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3;4 5 6;7 8 9];\r\ny_correct = [1 3 5 7 9 8 6 4 2]'\r\nassert(isequal(vectorizeit(x),y_correct))\r\n%%\r\nx = [5 8 9 ;7 22 9];\r\ny_correct = [5 7 9 22 8]'\r\nassert(isequal(vectorizeit(x),y_correct))\r\n%%\r\nx = [88 99; 0  64];\r\ny_correct = [99 88 64 0]'\r\nassert(isequal(vectorizeit(x),y_correct))\r\n%%\r\nx = [0 0; 1  1];\r\ny_correct = [1 0]'\r\nassert(isequal(vectorizeit(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":49,"test_suite_updated_at":"2017-12-08T14:05:18.000Z","rescore_all_solutions":false,"group_id":675,"created_at":"2017-12-08T13:29:49.000Z","updated_at":"2026-02-18T16:47:59.000Z","published_at":"2017-12-08T13:29:49.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven a matrix, make in the output 1 column vector putting odd numbers in ascending order after that put the even numbers in descending order.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNote\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e :no repeated numbers in the output. Example\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x=   1     2     3\\n     4     5     6\\n     7     8     9\\n\\ny=   1\\n     3\\n     5\\n     7\\n     9\\n     8\\n     6\\n     4\\n     2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43072,"title":"Check if a rotated array was originally sorted","description":"Suppose a sorted array is rotated at some pivot unknown to you. For example, |[0 1 2 4 5 6 7]|  might become |[5 6 7 0 1 2 4]|.\r\n\r\nGiven a rotated array, find out if it was originally sorted. Your function will return *true* for this array: |[4 5 6 7 0 1 2]|. But it will return *false* for |[2 5 6 8 0 1 3]|, because its original array, i.e.,  |[0 1 3 2 5 6 8]|, was not sorted.","description_html":"\u003cp\u003eSuppose a sorted array is rotated at some pivot unknown to you. For example, \u003ctt\u003e[0 1 2 4 5 6 7]\u003c/tt\u003e  might become \u003ctt\u003e[5 6 7 0 1 2 4]\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eGiven a rotated array, find out if it was originally sorted. Your function will return \u003cb\u003etrue\u003c/b\u003e for this array: \u003ctt\u003e[4 5 6 7 0 1 2]\u003c/tt\u003e. But it will return \u003cb\u003efalse\u003c/b\u003e for \u003ctt\u003e[2 5 6 8 0 1 3]\u003c/tt\u003e, because its original array, i.e.,  \u003ctt\u003e[0 1 3 2 5 6 8]\u003c/tt\u003e, was not sorted.\u003c/p\u003e","function_template":"function y = isRotaSorTED(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = [4 5 6 7 0 1 2];\r\ny_correct = true;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = [2 5 6 8 0 1 3];\r\ny_correct = false;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = [101, 103, 106, 109, 158, 164, 182, 187, 202, 205, 2, 3, 32, 57, 69, 74, 81, 99, 100];\r\ny_correct = true;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = [42 1:10];\r\ny_correct = true;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = 1:10;\r\nx(1) = 100; x(4) = 1;\r\ny_correct = false;\r\nassert(isequal(isRotaSorTED(x),y_correct))\r\n\r\n%%\r\nx = 10:-1:1;\r\ny_correct = false;\r\nassert(isequal(isRotaSorTED(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":25354,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":80,"test_suite_updated_at":"2018-05-23T13:13:55.000Z","rescore_all_solutions":false,"group_id":43,"created_at":"2016-10-05T19:43:37.000Z","updated_at":"2025-12-23T03:42:59.000Z","published_at":"2016-10-05T19:43:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSuppose a sorted array is rotated at some pivot unknown to you. For example,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[0 1 2 4 5 6 7]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e might become\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[5 6 7 0 1 2 4]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a rotated array, find out if it was originally sorted. Your function will return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003etrue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e for this array:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[4 5 6 7 0 1 2]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. But it will return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efalse\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e for\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[2 5 6 8 0 1 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, because its original array, i.e., \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[0 1 3 2 5 6 8]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, was not sorted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44541,"title":"Arrange the names in alphabetical order (2)","description":"Arrange the list of names in alphabetical order, following the German standard \u003chttps://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutschland *DIN 5007*, Variant 2, §6.1.1.4.2 — _for lists of people's names_\u003e.  \r\n\r\nSpecial characters:   \r\nä = ae,   \r\nö = oe,   \r\nü = ue,   \r\nß = ss.  \r\n\r\nThe above special characters *must* be heeded in determining the correct sequence, and retained unaltered in the final output.  Other accents would typically be ignored, but are in any case not present in the Test Suite.  Hyphens and spaces do not affect the sequence.  \r\n\r\nPrefixes:   \r\nIgnore \u003chttps://de.wikipedia.org/wiki/Namenszusatz#Ursprüngliche_Herkunftsbezeichnungen prefixes\u003e such as \"von\", \"von der\", \"vor\", \"am\", \"zum\". These can, in general, be identified in that they are *not* capitalised — _see example below_.  Capitalisation (uppercase versus lowercase) must be preserved in your final output.  \r\n\r\nSorting should be based on the _surname_ [~family name].  The surname (together with any prefixes!) will always appear _first_, followed by a comma and then the given name(s) [first name(s)].  \r\nIn principle, if two surnames were alike, then one would have to next sort by the given name(s) — however, that situation does *not* arise, and will not arise, in the Test Suite.  \r\n\r\nInputs comprise cell arrays of character vectors.  The cell arrays can be either row or column vectors.  Return your output in the same type of vector.  \r\n\r\nEXAMPLE:\r\n\r\n % Input\r\n in = {'Hofmann, Michael' \r\n       'Hölderlin, Friedrich' \r\n       'Holz, Arno'\r\n       'van Hoddis, Jakob' \r\n       'von Hofmannsthal, Hugo'}\r\n % Output\r\n out = {'van Hoddis, Jakob' \r\n       'Hölderlin, Friedrich' \r\n       'Hofmann, Michael' \r\n       'von Hofmannsthal, Hugo' \r\n       'Holz, Arno'}\r\n\r\nSee also:\r\n\r\n* \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44538 Problem 44538\u003e","description_html":"\u003cp\u003eArrange the list of names in alphabetical order, following the German standard \u003ca href = \"https://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutschland\"\u003e\u003cb\u003eDIN 5007\u003c/b\u003e, Variant 2, §6.1.1.4.2 — \u003ci\u003efor lists of people's names\u003c/i\u003e\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eSpecial characters:   \r\nä = ae,   \r\nö = oe,   \r\nü = ue,   \r\nß = ss.\u003c/p\u003e\u003cp\u003eThe above special characters \u003cb\u003emust\u003c/b\u003e be heeded in determining the correct sequence, and retained unaltered in the final output.  Other accents would typically be ignored, but are in any case not present in the Test Suite.  Hyphens and spaces do not affect the sequence.\u003c/p\u003e\u003cp\u003ePrefixes:   \r\nIgnore \u003ca href = \"https://de.wikipedia.org/wiki/Namenszusatz#Ursprüngliche_Herkunftsbezeichnungen\"\u003eprefixes\u003c/a\u003e such as \"von\", \"von der\", \"vor\", \"am\", \"zum\". These can, in general, be identified in that they are \u003cb\u003enot\u003c/b\u003e capitalised — \u003ci\u003esee example below\u003c/i\u003e.  Capitalisation (uppercase versus lowercase) must be preserved in your final output.\u003c/p\u003e\u003cp\u003eSorting should be based on the \u003ci\u003esurname\u003c/i\u003e [~family name].  The surname (together with any prefixes!) will always appear \u003ci\u003efirst\u003c/i\u003e, followed by a comma and then the given name(s) [first name(s)].  \r\nIn principle, if two surnames were alike, then one would have to next sort by the given name(s) — however, that situation does \u003cb\u003enot\u003c/b\u003e arise, and will not arise, in the Test Suite.\u003c/p\u003e\u003cp\u003eInputs comprise cell arrays of character vectors.  The cell arrays can be either row or column vectors.  Return your output in the same type of vector.\u003c/p\u003e\u003cp\u003eEXAMPLE:\u003c/p\u003e\u003cpre\u003e % Input\r\n in = {'Hofmann, Michael' \r\n       'Hölderlin, Friedrich' \r\n       'Holz, Arno'\r\n       'van Hoddis, Jakob' \r\n       'von Hofmannsthal, Hugo'}\r\n % Output\r\n out = {'van Hoddis, Jakob' \r\n       'Hölderlin, Friedrich' \r\n       'Hofmann, Michael' \r\n       'von Hofmannsthal, Hugo' \r\n       'Holz, Arno'}\u003c/pre\u003e\u003cp\u003eSee also:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44538\"\u003eProblem 44538\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e","function_template":"% Comments ...\r\nfunction y = meSortEm( xVector )\r\n    z = x;\r\nend","test_suite":"%% Ensure generality\r\n% Don't hardcode solutions or use test-specific lookup tables of surnames.\r\n% (Lookup tables of letters and/or prefixes are allowed, if you want, though.)\r\nRE = regexp(fileread('meSortEm.m'), '\\w+', 'match');\r\ntabooWords = {'Hölderlin' 'Friedrich' 'Holz' 'Arno' ...\r\n                'Hoffmann' 'Josef' 'Hübsch' 'Heinrich' ...\r\n                'Grass' 'Günter' 'Grünberg' 'Arnon' 'Strauch' 'Hugo' 'Strauß' 'Botho' ...\r\n                'Deutsch' 'Gerti' 'Dietrich' 'Adolf' 'Dücker' 'Eugen'};\r\ntestResult = cellfun( @(z) ismember(z, lower(tabooWords)), lower(RE) );\r\nmsg = ['Please do not hard-code your ''solution''.' char([10 13]) 'Found: ' strjoin(RE(testResult)) '.' char([10 13])];\r\nassert( ~any( testResult ), msg )\r\n\r\n\r\n%% A few authors, as in the example from the Problem Statement\r\nlist = {'van Hoddis, Jakob' \r\n       'Hölderlin, Friedrich' \r\n       'Hofmann, Michael' \r\n       'von Hofmannsthal, Hugo' \r\n       'Holz, Arno'};\r\ninput = {'Hofmann, Michael' \r\n       'Hölderlin, Friedrich' \r\n       'Holz, Arno'\r\n       'van Hoddis, Jakob' \r\n       'von Hofmannsthal, Hugo'};\r\nassert( isequal(meSortEm(input), list) )\r\n\r\n\r\n%% Architects\r\ndata = {'Auböck, Maria' 'Behnisch, Günther' 'Böhm, Elisabeth' 'van den Broek, Jo' 'van Campen, Jacob' 'Dudok, Willem Marinus' 'von Erdmannsdorff, Frederick William' 'van Eyck, Aldo' ...\r\n    'Gaddi, Taddeo' 'von Gärtner, Friedrich' 'Galilei, Alessandro' 'Gang, Jeanne' 'Gardella, Ignazio' 'Garnier, Charles' 'Gatermann, Dörte' 'Gauzin-Müller, Dominique' ...\r\n    'von Gontard, Carl' 'Höger, Fritz' 'Hoffmann, Josef' 'Hübsch, Heinrich' 'Hundertwasser, Friedensreich Regentag Dunkelbunt' 'de Key, Lieven' 'de Keyser, Hendrick' 'von Klenze, Leo' ...\r\n    'von Knobelsdorff, Georg Wenzeslaus' 'Mies, Maria Ludwig Michael' 'Mies van der Rohe, Ludwig' 'Pöppelmann, Matthäus Daniel' 'van Ravesteyn, Sybold' 'de Ridder van Groenesteyn, Stefan' 'von Ritter zu Groenesteyn, Caspar Wilhelm' 'von Ritter von Grünstein, Anselm Franz' ...\r\n    'Schneider-Esleben, Paul' 'Schütte-Lihotzky, Margarete' 'Staal-Kropholler, Margaret' 'Stowasser, Friedrich' 'van der Vlugt, Leendert' 'Wils, Jan' 'van Winden, Wilfried' 'van Zuuk, René'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 20+randi(L-20));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Authors\r\ndata = {'von Arnim, Bettina' 'Böll, Heinrich' 'Büchner, Georg' 'Busch, Wilhelm' 'von Doderer, Heimito' 'von Droste-Hülshoff, Annette' 'von Ebner-Eschenbach, Marie' 'von Eichendorff, Joseph' 'von Eschenbach, Wolfram' 'Fleißer, Marieluise' ...\r\n    'Gauß, Karl-Markus' 'Görres, Joseph' 'von Goethe, Johann Wolfgang' 'Grass, Günter' 'Grünberg, Arnon' 'Haasse, Hella' 'Härtling, Peter' 'Hamerling, Robert' 'Handke, Peter' 'von Hardenberg, Georg Philipp Friedrich' ...\r\n    'de Hartog, Jan' 'Heißenbüttel, Helmut' 'Hochhuth, Rolf' 'Hölderlin, Friedrich' 'Hoffmann, E.T.A.' 'von Hofmannsthal, Hugo' 'Jünger, Ernst' 'Kästner, Erich' 'Kaminer, Wladimir' 'Kehlmann, Daniel' ...\r\n    'von Kleist, Heinrich' 'Kofler, Werner' 'Laßwitz, Kurd' 'von Leitner, Karl Gottfried' 'Lenz, Siegfried' 'Lernet-Holenia, Alexander' 'van Loon, Hendrik Willem' 'Nöstlinger, Christine' 'Preußler, Otfried' 'von Pückler-Muskau, Hermann Ludwig Heinrich' ...\r\n    'Raabe, Wilhelm' 'Raimund, Ferdinand' 'Rühmkorf, Peter' 'Strätz, Harald' 'Strahl, Manfred' 'Stramm, August' 'von Straßburg, Gottfried' 'Strasser, Charlot' 'Stratz, Rudolph' 'Straub, Maria Elisabeth' ...\r\n    'Strauch, Hugo' 'Strauß, Botho' 'von Strauß und Torney, Luise Elisabeth' 'Suchenwirt, Peter' 'Sudermann, Hermann' 'Sülzer, Bernd' 'Süskind, Patrick' 'Süßmann, Christel' 'Süverkrüp, Dieter' 'Sula, Marianne' ...\r\n    'Sulzenbacher, Hannes' 'Sulzer, Alain Claude' 'von Suttner, Bertha' 'von Trimberg, Süßkind' 'von der Vogelweide, Walter' 'van den Vondel, Joost' 'Voß, Johann Heinrich' 'de Vries, Anne' 'von Waldenfels, Rudolf' 'Walser, Martin' ...\r\n    'von Weißenburg, Otfrid' 'van de Wetering, Janwillem' 'von Wilpert, Gero' 'von Wolkenstein, Oswald' 'von Zatzikhoven, Ulrich'};\r\ndata = data';\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 35+randi(L-35));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Artists, esp. painters (~A \u0026 D)\r\n% Amended 2018-03-11 to remove duplicate surname.  \r\ndata = {'Albers, Josef' 'Aldenrath, Heinrich Jacob' 'Alexander, William' 'Allers, Christian Wilhelm' 'Daege, Eduard' 'Dähling, Heinrich Anton' 'Dahm, Helen' 'Danckerts, Hendrick' ...\r\n    'Danioth, Heinrich' 'Dauerer, Gabriela' 'Decker, Cornelis Gerritsz' 'Degen, Paul' 'van Delen, Dirck' 'Deutsch, Gerti' 'van Diepenbeeck, Abraham' 'Diepraam, Abraham' ...\r\n    'Dietrich, Adolf' 'Dietz, Feodor' 'von Diez, Wilhelm' 'van Dijck, Floris Claesz' 'Dill, Ludwig' 'von Dillis, Johann Georg' 'Dinger, Fritz' 'Dinglinger, Georg Friedrich' ...\r\n    'Disler, Martin' 'Disteli, Martin' 'Dix, Otto' 'Doepler, Emil' 'Dörbeck, Franz Burchard' 'Doerner, Max' 'Domscheit, Franz' 'Donck, Gerard' ...\r\n    'Doomer, Lambert' 'Dou, Gerard' 'Drache, Heinz' 'Dräger, Anton Josef' 'Dreber, Heinrich' 'Dreesen, Willi' 'Droochsloot, Cornelis' ...\r\n    'Drost, Willem' 'Dryander, Johann Friedrich' 'Dubbels, Hendrick Jacobsz' 'Dubordieu, Pieter' 'Duck, Jacob' 'Dücker, Eugen' 'Dürer, Albrecht' 'Dufaux, Henri' ...\r\n    'Dujardin, Karel' 'Dunker, Balthasar Anton' 'Dusart, Cornelis' 'Duyster, Willem Cornelisz' 'Dyck, Hermann' 'Dziersk, Udo'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 25+randi(L-25));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Hyphenated names\r\n% Added 2018-03-11 to test handling of hyphenation.  \r\ndata = {'Droste, Udo' 'Droste-Doderer, Heimito' 'von Droste-Hülshoff, Gerti' 'Droste-Strauß, Annette' 'Ebner, Wolfram' 'Ebner-Eichendorff, Willem' 'von Ebner-Eschenbach, Marie' 'Ebner-Nöstlinger, Christine' 'von Gauzin, Carl' 'Gauzin-Gatermann, Dominique' ...\r\n    'van Gauzin-Gontard, Dörte' 'Gauzin-Müller, Anton' 'Lernet, Hermann' 'Lernet-Holenia, Willem' 'Lernet-Loon, Hendrik' 'van Lernet-Süßmann, Christel' 'Pückler, Ludwig' 'Pückler-Dauerer, Gabriela' 'von Pückler-Muskau, Otfried' 'Pückler-Preußler, Heinrich'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 10+randi(L-10));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":"2018-03-11T05:39:54.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-03-10T03:11:08.000Z","updated_at":"2018-03-11T05:39:54.000Z","published_at":"2018-03-10T05:27:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eArrange the list of names in alphabetical order, following the German standard\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutschland\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDIN 5007\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, Variant 2, §6.1.1.4.2 —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efor lists of people's names\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSpecial characters:    ä = ae,    ö = oe,    ü = ue,    ß = ss.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe above special characters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e be heeded in determining the correct sequence, and retained unaltered in the final output. Other accents would typically be ignored, but are in any case not present in the Test Suite. Hyphens and spaces do not affect the sequence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrefixes:    Ignore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://de.wikipedia.org/wiki/Namenszusatz#Ursprüngliche_Herkunftsbezeichnungen\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eprefixes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e such as \\\"von\\\", \\\"von der\\\", \\\"vor\\\", \\\"am\\\", \\\"zum\\\". These can, in general, be identified in that they are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e capitalised —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esee example below\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Capitalisation (uppercase versus lowercase) must be preserved in your final output.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSorting should be based on the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esurname\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [~family name]. The surname (together with any prefixes!) will always appear\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efirst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, followed by a comma and then the given name(s) [first name(s)]. In principle, if two surnames were alike, then one would have to next sort by the given name(s) — however, that situation does\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e arise, and will not arise, in the Test Suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % Input\\n in = {'Hofmann, Michael' \\n       'Hölderlin, Friedrich' \\n       'Holz, Arno'\\n       'van Hoddis, Jakob' \\n       'von Hofmannsthal, Hugo'}\\n % Output\\n out = {'van Hoddis, Jakob' \\n       'Hölderlin, Friedrich' \\n       'Hofmann, Michael' \\n       'von Hofmannsthal, Hugo' \\n       'Holz, Arno'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44538\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44538\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1893,"title":"GJam 2014 China Rd A: Library Sorting (Small)","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2924486/dashboard#s=p2 GJam 2014 China Sorting\u003e. \r\n\r\nThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations. \r\n\r\n*Input:* V   a vector\r\n\r\n*Output:* Vout  a sorted vector Odds Increasing/Evens Increasing\r\n\r\n*Example:*\r\n\r\nV= [-5 -12 87 2 88 20 11]\r\n\r\nVout=[-5 88 11 20 2 -12 87]\r\n\r\n\r\n*Contest Performance:*  Best Time to Complete: \u003c 10 minutes\r\n","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\"\u003eGJam 2014 China Sorting\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e V   a vector\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Vout  a sorted vector Odds Increasing/Evens Increasing\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eV= [-5 -12 87 2 88 20 11]\u003c/p\u003e\u003cp\u003eVout=[-5 88 11 20 2 -12 87]\u003c/p\u003e\u003cp\u003e\u003cb\u003eContest Performance:\u003c/b\u003e  Best Time to Complete: \u0026lt; 10 minutes\u003c/p\u003e","function_template":"function vout=Sort_CH(v)\r\n vout=v;\r\nend","test_suite":"%%\r\ntic\r\nv=[1 ];\r\nvexp=[1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[2 1 ];\r\nvexp=[2 1 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 ];\r\nvexp=[1 2 3 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[1 2 3 4 5 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[5 2 3 4 1 ];\r\nvexp=[1 4 3 2 5 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 -87 -85 -83 -71 -71 98 96 -67 -63 -59 -53 -47 -41 96 -41 82 -37 -29 82 -25 -25 80 -21 -13 -11 5 76 72 72 66 66 66 9 60 15 31 35 56 52 52 46 42 39 45 42 40 36 45 30 24 18 51 18 12 53 0 63 -6 65 -10 -12 67 69 79 85 85 -14 89 -16 -22 89 -24 91 -24 -26 -30 -38 -38 -38 -42 -44 -58 -58 -60 -62 -66 -68 -70 -70 -82 -82 -86 -86 -86 -94 -100 ];\r\nvexp=[-87 -87 -85 -83 -71 -71 98 96 -67 -63 -59 -53 -47 -41 96 -41 82 -37 -29 82 -25 -25 80 -21 -13 -11 5 76 72 72 66 66 66 9 60 15 31 35 56 52 52 46 42 39 45 42 40 36 45 30 24 18 51 18 12 53 0 63 -6 65 -10 -12 67 69 79 85 85 -14 89 -16 -22 89 -24 91 -24 -26 -30 -38 -38 -38 -42 -44 -58 -58 -60 -62 -66 -68 -70 -70 -82 -82 -86 -86 -86 -94 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-95 98 -81 -55 90 -29 -19 35 37 75 79 85 93 97 56 54 14 14 0 -14 -22 -34 -38 -46 -62 -90 -98 ];\r\nvexp=[-95 98 -81 -55 90 -29 -19 35 37 75 79 85 93 97 56 54 14 14 0 -14 -22 -34 -38 -46 -62 -90 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-89 -75 -73 -65 86 86 68 66 -41 -37 -25 56 5 21 25 52 36 26 14 27 29 35 45 6 51 63 87 93 -22 95 -26 -48 -54 -70 95 -86 -92 -96 ];\r\nvexp=[-89 -75 -73 -65 86 86 68 66 -41 -37 -25 56 5 21 25 52 36 26 14 27 29 35 45 6 51 63 87 93 -22 95 -26 -48 -54 -70 95 -86 -92 -96 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[76 -7 ];\r\nvexp=[76 -7 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-93 96 -91 86 -87 -87 -67 -53 68 30 -33 0 -33 -13 1 0 3 -10 3 -10 -16 19 23 45 51 -18 53 -30 -36 -72 79 -82 -96 83 91 ];\r\nvexp=[-93 96 -91 86 -87 -87 -67 -53 68 30 -33 0 -33 -13 1 0 3 -10 3 -10 -16 19 23 45 51 -18 53 -30 -36 -72 79 -82 -96 83 91 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 100 96 -81 86 -79 -79 -77 -73 -69 -69 -65 82 -59 -59 70 70 -57 -49 -47 70 -43 -41 54 -35 -31 -31 -29 -25 -17 -13 -5 50 -5 -3 7 21 25 46 27 27 44 31 33 35 37 44 49 42 38 49 51 34 69 34 75 83 20 85 87 91 91 14 12 10 6 0 0 0 -8 -8 -20 -24 -26 -34 -36 -40 -52 -56 -60 -66 -68 -68 -72 -72 -80 -84 -84 -90 -90 ];\r\nvexp=[-87 100 96 -81 86 -79 -79 -77 -73 -69 -69 -65 82 -59 -59 70 70 -57 -49 -47 70 -43 -41 54 -35 -31 -31 -29 -25 -17 -13 -5 50 -5 -3 7 21 25 46 27 27 44 31 33 35 37 44 49 42 38 49 51 34 69 34 75 83 20 85 87 91 91 14 12 10 6 0 0 0 -8 -8 -20 -24 -26 -34 -36 -40 -52 -56 -60 -66 -68 -68 -72 -72 -80 -84 -84 -90 -90 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 100 -81 -75 96 86 -71 -71 86 -33 -27 -25 82 -21 76 -11 68 5 7 9 13 68 15 25 41 41 51 61 56 61 56 67 54 67 48 83 89 91 99 34 30 28 16 16 10 10 4 0 0 0 0 -24 -26 -26 -34 -48 -50 -62 -66 -92 -100 ];\r\nvexp=[-87 100 -81 -75 96 86 -71 -71 86 -33 -27 -25 82 -21 76 -11 68 5 7 9 13 68 15 25 41 41 51 61 56 61 56 67 54 67 48 83 89 91 99 34 30 28 16 16 10 10 4 0 0 0 0 -24 -26 -26 -34 -48 -50 -62 -66 -92 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-93 -89 -87 88 -85 -75 -65 -63 -61 -59 -49 84 -39 -37 80 80 -37 -25 -11 -7 78 -5 78 72 3 5 9 58 11 50 46 23 29 29 31 35 44 37 49 67 71 44 40 30 71 30 28 24 75 75 79 83 18 97 99 6 6 2 0 -4 -8 -10 -16 -18 -30 -32 -34 -36 -38 -46 -46 -48 -48 -52 -54 -56 -66 -68 -88 -90 -100 -100 -100 ];\r\nvexp=[-93 -89 -87 88 -85 -75 -65 -63 -61 -59 -49 84 -39 -37 80 80 -37 -25 -11 -7 78 -5 78 72 3 5 9 58 11 50 46 23 29 29 31 35 44 37 49 67 71 44 40 30 71 30 28 24 75 75 79 83 18 97 99 6 6 2 0 -4 -8 -10 -16 -18 -30 -32 -34 -36 -38 -46 -46 -48 -48 -52 -54 -56 -66 -68 -88 -90 -100 -100 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[90 -89 90 74 -87 62 -83 -79 58 -77 -75 -75 -63 52 52 -59 46 42 -49 -39 -31 36 12 -25 6 -13 -11 5 9 17 23 29 39 -2 -8 -10 47 63 -28 -54 -70 -74 -78 63 65 83 -82 -84 91 97 97 ];\r\nvexp=[90 -89 90 74 -87 62 -83 -79 58 -77 -75 -75 -63 52 52 -59 46 42 -49 -39 -31 36 12 -25 6 -13 -11 5 9 17 23 29 39 -2 -8 -10 47 63 -28 -54 -70 -74 -78 63 65 83 -82 -84 91 97 97 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-97 88 -93 74 70 46 38 36 -91 -85 -83 -77 -67 -63 -55 34 -45 32 -37 16 0 0 -23 -21 -2 -4 5 13 27 -10 -32 -38 -38 -50 39 -56 45 49 -56 77 -56 87 95 97 -62 -62 -68 -68 -72 -80 -94 ];\r\nvexp=[-97 88 -93 74 70 46 38 36 -91 -85 -83 -77 -67 -63 -55 34 -45 32 -37 16 0 0 -23 -21 -2 -4 5 13 27 -10 -32 -38 -38 -50 39 -56 45 49 -56 77 -56 87 95 97 -62 -62 -68 -68 -72 -80 -94 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[81 29 29 -71 -70 16 -70 -93 25 97 51 3 -8 39 -83 97 98 -86 -53 69 58 86 19 75 9 87 -84 66 75 82 85 -87 53 7 65 99 -93 59 -74 4 1 -15 -22 59 -35 -15 51 -10 -27 -98 60 -17 37 29 -98 69 83 9 51 13 -12 -13 50 -39 45 5 -34 75 -84 15 -91 18 -97 -8 0 -44 34 79 -13 -74 -92 80 -84 -92 -32 -46 -26 46 -16 -32 -72 16 84 -46 22 -32 84 58 28 -60 ];\r\nvexp=[-97 -93 -93 -91 98 86 84 -87 -83 -71 -53 -39 84 -35 -27 -17 82 80 -15 -15 66 60 -13 -13 1 3 58 58 5 50 7 9 9 13 15 19 25 29 46 34 29 29 28 37 39 45 51 22 51 18 16 51 53 59 16 59 65 69 69 75 4 75 0 75 79 81 -8 83 -8 85 87 -10 97 -12 -16 -22 -26 97 99 -32 -32 -32 -34 -44 -46 -46 -60 -70 -70 -72 -74 -74 -84 -84 -84 -86 -92 -92 -98 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[10 50 52 3 -29 51 29 -89 55 -34 -77 -41 65 7 -89 0 -44 -98 61 -21 11 -57 -10 95 -12 -25 91 28 90 -49 -57 97 57 -47 33 -59 7 -39 55 91 -89 -41 -7 -18 -61 -93 78 -57 97 45 44 -59 5 38 9 28 -38 11 -36 -92 15 -70 44 -84 18 -24 38 20 -54 0 2 44 28 12 42 -22 74 6 -72 -52 34 -50 30 -44 -6 -42 98 -96 42 38 64 92 -36 92 -90 2 -6 -44 -98 -2 ];\r\nvexp=[98 92 92 -93 -89 -89 -89 -77 -61 90 -59 -59 -57 -57 -57 78 74 64 -49 -47 -41 -41 52 -39 50 -29 -25 44 44 -21 -7 3 5 7 7 9 11 11 15 29 33 45 51 44 55 55 42 57 61 65 42 91 91 38 95 38 38 97 34 30 97 28 28 28 20 18 12 10 6 2 2 0 0 -2 -6 -6 -10 -12 -18 -22 -24 -34 -36 -36 -38 -42 -44 -44 -44 -50 -52 -54 -70 -72 -84 -90 -92 -96 -98 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[34 46 -93 78 -26 11 77 26 47 73 75 53 -89 -52 71 19 -52 -47 16 -19 74 49 21 1 -33 -89 5 -74 67 -55 88 -85 1 -41 93 53 -97 61 -71 -85 77 -45 -1 0 74 95 67 -65 -27 -2 -44 -8 -37 27 36 -58 71 -8 -95 43 17 -19 25 -5 -10 42 10 -64 27 94 41 -69 37 81 -97 -50 -54 66 -22 40 -62 90 -70 40 48 48 52 48 20 98 -42 92 88 40 36 -28 -10 -44 -52 96 ];\r\nvexp=[98 96 -97 94 92 -97 -95 90 -93 -89 -89 -85 -85 88 -71 -69 88 -65 78 -55 74 -47 -45 -41 -37 -33 -27 74 -19 -19 66 -5 -1 1 1 5 11 17 19 21 25 27 27 52 48 37 41 43 47 48 48 46 49 53 42 40 53 40 61 67 67 71 71 73 40 36 36 34 75 26 77 77 81 93 95 20 16 10 0 -2 -8 -8 -10 -10 -22 -26 -28 -42 -44 -44 -50 -52 -52 -52 -54 -58 -62 -64 -70 -74 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-27 ];\r\nvexp=[-27 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[53 75 55 -92 23 -19 83 -70 95 43 -57 1 -11 -9 42 -98 -30 -35 -35 94 -95 -43 -11 -44 96 53 23 -80 -77 -32 -34 45 -16 -2 -77 56 -92 0 -15 38 36 4 -18 72 -84 88 48 58 82 -4 88 -62 -10 -30 10 -100 22 0 -12 -40 -48 -74 ];\r\nvexp=[-95 -77 -77 96 -57 -43 -35 94 -35 -19 -15 -11 -11 -9 88 88 82 1 23 72 23 43 45 58 56 53 53 48 55 42 38 75 36 22 83 10 4 0 95 0 -2 -4 -10 -12 -16 -18 -30 -30 -32 -34 -40 -44 -48 -62 -70 -74 -80 -84 -92 -92 -98 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-87 63 -79 74 66 5 -51 -9 69 -58 -23 77 -75 -71 91 0 -40 41 -79 32 27 90 66 -56 100 -48 -80 14 -24 ];\r\nvexp=[-87 -79 -79 100 90 -75 -71 -51 -23 74 -9 5 27 41 63 66 66 69 77 32 91 14 0 -24 -40 -48 -56 -58 -80 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[91 34 34 -92 -34 42 99 51 0 54 17 -51 -31 -45 35 -33 92 7 -33 -45 0 -15 76 58 58 100 85 -68 5 -20 -13 83 -39 89 55 89 -90 84 -40 20 90 54 -84 -90 38 -100 60 64 54 32 -30 86 -60 90 -46 -58 -50 ];\r\nvexp=[-51 100 92 90 90 86 -45 -45 84 76 -39 -33 -33 -31 -15 -13 64 5 7 17 60 35 58 58 54 54 51 54 55 42 83 85 89 89 91 99 38 34 34 32 20 0 0 -20 -30 -34 -40 -46 -50 -58 -60 -68 -84 -90 -90 -92 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-41 25 30 -41 20 51 -75 -72 45 -73 75 -77 60 -79 -45 80 19 49 -25 -99 -16 71 55 -79 -35 31 -66 61 -19 -45 -55 -34 73 -55 17 -29 -41 65 -93 51 -58 62 99 73 59 -66 83 -95 -23 62 -82 -81 -31 -33 -9 -41 1 83 36 92 82 80 0 10 78 38 70 0 -52 4 -56 88 -92 -14 56 -6 -74 -90 92 96 86 96 -88 ];\r\nvexp=[-99 -95 96 -93 96 -81 -79 92 -79 -77 -75 -73 92 -55 -55 88 -45 -45 -41 -41 86 -41 -41 -35 -33 -31 82 -29 -25 -23 -19 80 -9 1 17 19 25 31 45 49 80 78 51 51 55 70 59 61 65 62 62 71 73 73 75 83 83 99 60 56 38 36 30 20 10 4 0 0 -6 -14 -16 -34 -52 -56 -58 -66 -66 -72 -74 -82 -88 -90 -92 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-55 93 -57 -68 25 48 -100 75 11 -82 -60 64 74 19 11 -87 -56 -10 45 74 -21 -5 1 12 55 66 -72 73 37 85 -97 -80 51 44 55 -54 -15 -79 32 -93 1 23 -77 -86 90 -71 82 4 14 -100 55 -51 33 -60 65 -30 -34 -37 -75 75 90 33 -35 38 -97 -72 49 4 24 42 88 -60 -78 -68 0 48 -44 -56 24 -12 -48 -78 100 68 -32 -58 24 -44 94 ];\r\nvexp=[-97 -97 -93 100 -87 94 90 -79 -77 90 88 82 74 -75 -71 -57 74 68 -55 66 -51 -37 -35 64 -21 48 48 -15 -5 1 1 44 11 42 11 38 19 23 32 25 33 33 37 24 24 45 24 14 12 4 49 51 55 4 55 0 -10 55 65 73 -12 75 75 -30 85 -32 93 -34 -44 -44 -48 -54 -56 -56 -58 -60 -60 -60 -68 -68 -72 -72 -78 -78 -80 -82 -86 -100 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-41 97 83 0 -33 87 29 18 21 30 90 4 -10 -56 -66 79 -25 55 -40 -55 1 1 0 85 -66 -15 36 -68 -100 65 -8 -77 64 -47 -60 -96 83 -67 12 -85 11 24 -63 -50 17 -60 ];\r\nvexp=[-85 -77 -67 90 -63 -55 -47 64 -41 36 30 24 18 12 4 -33 -25 -15 0 1 1 11 0 17 -8 21 -10 -40 -50 29 -56 55 -60 65 -60 -66 79 83 -66 83 85 -68 87 -96 97 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-75 77 13 57 62 43 -9 13 -61 -37 -19 49 -1 65 -53 -87 -40 -73 -33 80 -11 15 73 -42 -58 -20 85 -97 -57 22 -46 -60 8 62 30 -84 66 40 58 -44 -100 ];\r\nvexp=[-97 -87 -75 -73 80 -61 -57 -53 -37 -33 -19 -11 -9 -1 13 13 66 15 43 62 49 57 65 62 58 40 73 77 85 30 22 8 -20 -40 -42 -44 -46 -58 -60 -84 -100 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[80 30 85 -54 -87 -32 47 33 57 -57 -64 50 67 -84 58 -79 37 -39 77 65 55 26 -58 47 -24 50 -34 72 65 30 38 -57 -49 13 -81 -3 -90 73 -69 91 -38 -49 -52 87 81 -70 51 -98 82 80 0 96 -68 -34 -54 -96 ];\r\nvexp=[96 82 -87 80 -81 80 -79 -69 -57 -57 72 58 -49 50 50 -49 -39 -3 13 33 37 38 30 47 30 26 0 -24 47 -32 -34 51 55 57 65 65 -34 67 73 77 -38 81 -52 85 87 -54 91 -54 -58 -64 -68 -70 -84 -90 -96 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[45 7 -49 57 7 -11 -7 53 -83 99 -90 9 87 100 16 -58 45 33 -98 30 -58 -50 -29 15 -66 76 -86 58 4 -82 ];\r\nvexp=[-83 -49 -29 -11 -7 7 7 9 15 33 100 45 45 76 58 30 53 57 16 4 -50 -58 87 99 -58 -66 -82 -86 -90 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[-13 20 -29 34 47 -38 -55 -25 37 41 -87 47 31 -63 -27 -68 -35 32 77 11 -7 -91 -67 -32 59 41 -11 -81 10 96 -50 -11 74 0 -42 -22 92 -72 46 0 0 -80 78 -32 58 4 24 -22 -56 -34 60 ];\r\nvexp=[-91 96 -87 92 -81 78 -67 -63 -55 -35 -29 -27 -25 -13 -11 74 -11 60 -7 11 31 37 41 58 41 47 47 59 46 34 32 77 24 20 10 4 0 0 0 -22 -22 -32 -32 -34 -38 -42 -50 -56 -68 -72 -80 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\n%%\r\nv=[35 69 33 35 -7 -54 -89 95 -95 -72 2 42 -89 -10 17 -65 -99 -43 27 95 71 61 -5 -95 -82 21 47 79 -59 52 -44 -10 -19 53 35 -92 -35 -61 -95 -43 35 -98 95 -2 -19 66 89 -54 32 -18 36 72 -64 -10 -88 -50 -8 38 88 -50 ];\r\nvexp=[-99 -95 -95 -95 -89 88 -89 -65 -61 72 66 52 -59 42 -43 -43 -35 -19 -19 -7 -5 17 21 27 38 33 35 35 35 36 32 2 35 47 53 -2 61 69 71 79 89 -8 95 -10 95 -10 95 -10 -18 -44 -50 -50 -54 -54 -64 -72 -82 -88 -92 -98 ];\r\nvout=Sort_CH(v);\r\nassert(isequal(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-26T03:58:52.000Z","updated_at":"2026-03-11T15:29:23.000Z","published_at":"2013-09-26T04:09:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2924486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2014 China Sorting\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to take a vector of Odd/Even values; Sort Odd Values Increasing and place into original Odd locations; Sort Even Values Decreasing and place into original Even locations.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e V a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Vout a sorted vector Odds Increasing/Evens Increasing\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eV= [-5 -12 87 2 88 20 11]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eVout=[-5 88 11 20 2 -12 87]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eContest Performance:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Time to Complete: \u0026lt; 10 minutes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":247,"title":"Arrange Vector in descending order","description":"If x=[0,3,4,2,1] then y=[4,3,2,1,0]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 102px 8px; transform-origin: 102px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf x=[0,3,4,2,1] then y=[4,3,2,1,0]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = desSort(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [0,1,2,3,4];\r\ny_correct = [4,3,2,1,0];\r\nassert(isequal(desSort(x),y_correct))\r\n\r\n%%\r\nx = randperm(10);\r\ny_correct = 10:-1:1;\r\nassert(isequal(desSort(x),y_correct))\r\n\r\n%%\r\nx = [13 11 19 7 17];\r\ny_correct = [19 17 13 11 7];\r\nassert(isequal(desSort(x),y_correct))\r\n\r\n%%\r\nx = [5     4     2    12    10     3     7     7     1];\r\ny_correct = [12, 10, 7, 7, 5, 4, 3, 2, 1];\r\nassert(isequal(desSort(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":68,"comments_count":17,"created_by":868,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13390,"test_suite_updated_at":"2021-07-22T15:14:15.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-03T16:06:15.000Z","updated_at":"2026-04-06T00:32:23.000Z","published_at":"2012-02-03T16:08:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf x=[0,3,4,2,1] then y=[4,3,2,1,0]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":60426,"title":"Reversing Maximal Ascending Subsequences","description":"Create and return a new array that contains the same elements as the input array, but with the elements within each strictly increasing maximal subsequence reversed. \r\nExample:\r\nGiven the input array [5, 7, 10, 4, 2, 7, 8, 1, 3], the strictly increasing maximal subsequences are [5, 7, 10], [2, 7, 8], and [1, 3]. Reversing these subsequences gives [10, 7, 5], [8, 7, 2], and [3, 1], respectively. The output array is thus [10, 7, 5, 4, 8, 7, 2, 3, 1].","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 149.489px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 386.491px 74.7443px; transform-origin: 386.499px 74.7443px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42.017px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 363.494px 21.0085px; text-align: left; transform-origin: 363.501px 21.0085px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCreate and return a new array that contains the same elements as the input array, but with the elements within each strictly increasing maximal subsequence reversed. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21.0085px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 363.494px 10.4972px; text-align: left; transform-origin: 363.501px 10.5043px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 68.4801px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 363.494px 34.233px; text-align: left; transform-origin: 363.501px 34.2401px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven the input array \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[5, 7, 10, 4, 2, 7, 8, 1, 3]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, the strictly increasing maximal subsequences are \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[5, 7, 10]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[2, 7, 8]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[1, 3]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Reversing these subsequences gives \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[10, 7, 5]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[8, 7, 2]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[3, 1]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, respectively. The output array is thus \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e[10, 7, 5, 4, 8, 7, 2, 3, 1]\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = reverse_ascending(x)\r\n\r\nend","test_suite":"%%\r\nx = [5, 7, 10, 4, 2, 7, 8, 1, 3]\r\ny = reverse_ascending(x)\r\ny_correct = [10, 7, 5, 4, 8, 7, 2, 3, 1]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [a a b]\r\ny = reverse_ascending(x)\r\ny_correct = [a b a]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [a b a]\r\ny = reverse_ascending(x)\r\ny_correct = [b a a]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [b a a]\r\ny = reverse_ascending(x)\r\ny_correct = x\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [a b a b a]\r\ny = reverse_ascending(x)\r\ny_correct = [b a b a a]\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\na = randi([1,10]);\r\nb = randi([11,20]);\r\nx = [b a b a b]\r\ny = reverse_ascending(x)\r\ny_correct = [b b a b a]\r\nassert(isequal(y,y_correct))\r\n\r\n%% strictly increasing\r\nx = [randi([10,20]) : randi([25,35]) ]\r\ny = reverse_ascending(x)\r\ny_correct = x(end:-1:1)\r\nassert(isequal(y,y_correct))\r\n\r\n%% strictly decreasing\r\nx = sort(unique(randi([1,99], 1, randi([10,25]))), 'descend')\r\ny = reverse_ascending(x)\r\ny_correct = x\r\nassert(isequal(y,y_correct))\r\n\r\n%% increasing than decreasing\r\na = [randi([10,20]) : randi([25,35]) ];\r\nb = sort(unique(randi([50,99], 1, randi([10,25]))), 'descend');\r\nx = [a b]\r\ny = reverse_ascending(x)\r\ny_correct = [b(1) a(end:-1:1) b(2:end)]\r\nassert(isequal(y,y_correct))\r\n\r\n%% constant\r\nx = randi([2,10])*ones(1,randi([2,10]))\r\ny = reverse_ascending(x)\r\ny_correct = x\r\nassert(isequal(y,y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":208445,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-06-02T11:24:05.000Z","updated_at":"2024-06-02T11:24:05.000Z","published_at":"2024-06-02T11:24:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate and return a new array that contains the same elements as the input array, but with the elements within each strictly increasing maximal subsequence reversed. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven the input array \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[5, 7, 10, 4, 2, 7, 8, 1, 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, the strictly increasing maximal subsequences are \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[5, 7, 10]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[2, 7, 8]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[1, 3]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Reversing these subsequences gives \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[10, 7, 5]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[8, 7, 2]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[3, 1]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, respectively. The output array is thus \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e[10, 7, 5, 4, 8, 7, 2, 3, 1]\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1844,"title":"Create a v-notch vector without \"sort\" function","description":"Given a vector vec, create a v-shaped vector as shown below: vec = [ 10 2 3 89 5 7 90 0 12]\r\nOutput vector = [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90]\r\nHere, all the elements of input vector are repeated in output vector, however first half part of the output vector is in descending order and rest is in ascending order. Once such output vector is plotted, it will show a v-shape on the graph. \r\nDo not use builtin sort function","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 132px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 66px; transform-origin: 407px 66px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 290.5px 8px; transform-origin: 290.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a vector vec, create a v-shaped vector as shown below: vec = [ 10 2 3 89 5 7 90 0 12]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 193px 8px; transform-origin: 193px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOutput vector = [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 361px 8px; transform-origin: 361px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHere, all the elements of input vector are repeated in output vector, however first half part of the output vector is in descending order and rest is in ascending order. Once such output vector is plotted, it will show a v-shape on the graph. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 96px 8px; transform-origin: 96px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eDo not use builtin sort function\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = vNotchVector(vec)\r\n  y = x;\r\nend","test_suite":"%%\r\nfiletext = fileread('vNotchVector.m');\r\nassert(isempty(strfind(filetext, 'sort')))\r\n\r\n%%\r\nvec = [ 10 2 3 89 5 7 90 0 12];\r\nvNotch= [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n\r\n%%\r\nvec = [ -8 -7 -6 -5 0 3 67 100 100 400];\r\nvNotch= [400 100 100 67 3 0 -5 -6 -7 -8 -8 -7 -6 -5 0 3 67 100 100 400];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n\r\n%%\r\nvec= [1 0 1 0 1 0 1 0 1 0 1 0];\r\nvNotch = [1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1  1 1 1 1 1];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n\r\n%%\r\nvec= 1:10;\r\nvNotch = [10:-1:1 1:10];\r\nassert(isequal(vNotchVector(vec),vNotch))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":33,"test_suite_updated_at":"2021-05-31T13:43:11.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-08-22T21:21:29.000Z","updated_at":"2021-05-31T13:44:34.000Z","published_at":"2013-08-22T21:21:29.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector vec, create a v-shaped vector as shown below: vec = [ 10 2 3 89 5 7 90 0 12]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput vector = [90 89 12 10 7 5 3 2 0 0 2 3 5 7 10 12 89 90]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHere, all the elements of input vector are repeated in output vector, however first half part of the output vector is in descending order and rest is in ascending order. Once such output vector is plotted, it will show a v-shape on the graph. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDo not use builtin sort function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":56523,"title":"Cricket - Sort Batters by Distance Run","description":"Given a string vector of batters' names, a vector of the total number of runs they scored, a vector of the number of 4s they scored, and a vector of the number of 6s, return a string array of the player's names sorted according to how far they actually ran for their runs, from farthest to least. You can assume that 4s and 6s were not run at all (so the problem is equivalent to sorting according to the number of runs scored not from boundaries).\r\nFor example,\r\n\r\nname = [\"Matt\";\"Ben\";\"Renee\"];\r\nruns = [6;18;20];\r\nfours = [0;2;3];\r\nsixes = [0;0;1];\r\n\r\nsortednames = sortbyrundistance(name,runs,fours,sixes)\r\nsortednames = \r\n  3×1 string array\r\n    \"Ben\"\r\n    \"Matt\"\r\n    \"Renee\"\r\nHere, Matt has run 6 runs, Ben 10 (8 of his total 18 came from 4s), Renee 2 (18 of her 20 runs came from boundaries).\r\nA batter's score is the total of runs physically run and runs scored from boundaries (hitting the ball to the boundary scores an automatic 4 runs, hitting it over the boundary scores an automatic 6 runs). The score is typically reported as the total runs scored, along with the number of boundary 4s and 6s. In the above example, Ben's score is 18 runs (total), including 2 4s and 0 6s. Hence, his score was 10 runs he actually ran, plus 8 runs from boundaries.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 652.267px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 326.133px; transform-origin: 407px 326.133px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 371px 8px; transform-origin: 371px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string vector of batters' names, a vector of the total number of runs they scored, a vector of the number of 4s they scored, and a vector of the number of 6s, return a string array of the player's names sorted according to how far they actually ran for their runs, from farthest to least. You can assume that 4s and 6s were not run at all (so the problem is equivalent to sorting according to the number of runs scored \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.5px 8px; transform-origin: 11.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 58px 8px; transform-origin: 58px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e from boundaries).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 41px 8px; transform-origin: 41px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example,\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 170.5px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 85.25px; text-align: left; transform-origin: 384px 85.25px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline;width: 324px;height: 165px\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQ8AAAKTCAMAAACAZA4rAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEaUExURQAAAABSewBMhwBNhgBLiABKhwBLhgAAAABLhwYHCAgICAsOEBAQEBBWjhEVGBZelhccIBddlhgYGBwjKCAgICBhliBiliIqMCJmnSJnnigoKCgxOC04QC1wpTAwMDBtnTBtnjM/SDg4ODhGUD5NWD94pUBAQEB4pUOCtEODtERUYEhISElbaE9icFBQUFVoeFhYWFpvf1qVw192h1+PtGBgYGV8j2Wey2hoaGuDl3BwcHCKn3aRp3h4eHyYr39/f3+lw4Gft4eHh4emv4e54Yytx4+Pj4+wy5K0z5eXl5i7153C35+fn6PJ56enp6nQ767X96+vr7Te/7e3t7+/v7/S4cfHx8/Pz9fX19/f3+fn5+/v7/f39////8eGjJwAAAAHdFJOUwAfQExYZHAd7kVNAAAACXBIWXMAADLAAAAywAEoZFrbAABT7ElEQVR4Xu2de3/UyJKmz84501rbLMsadtg1PuxwGc8cLg0eBgYaGgY8sDQ3G+PlYpvv/zVWIUVKmSqpKlNvGFPK9/mrKktdbfSLepSZEZn5p//yS8mf/46M5i9yB/U1GcPflzfw7/U1GYOE4F/0NRnBn+UO/pc//elPv/xXQgghv9CHhBBSQR8SQkgNfUgIITXiw7/Ii3/5VzKav8od1NdkDP+9vIH/XV+TMUgI/lVfkxH8i9zBv5Q+/Dt58Z/7ZDRVMOprMgZ5ovxVX5MxSAj+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gD82gD1HoQxQJQfoQgD40gz5EoQ9RJATpQwD60Az6EIU+RJEQpA8B6EMz6EMU+hBFQpA+BKAPzaAPUehDFAlB+hCAPjSDPkShD1EkBOlDgMaHfy8v/tdfyWj+h9zBfybj+W/lDfxv+pqMQULwf+prMoL/I3fw70sf/iIvCCEkc36hDwkhpII+JISQGvqQEEJqxIeEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhPww/vSn/w+Hk269rvlYfAAAAABJRU5ErkJggg==\" alt=\"Table showing runs, fours, and sixes for three batters. Matt has 6 runs, 0 fours, 0 sixes. Ben has 18 runs, 2 fours, 0 sixes. Renee has 20 runs, 3 fours, 1 six.\" data-image-state=\"image-loaded\" width=\"324\" height=\"165\"\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 224.767px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 112.383px; transform-origin: 404px 112.383px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 120px 8.5px; tab-size: 4; transform-origin: 120px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003ename = [\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e\"Matt\"\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e\"Ben\"\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 28px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 28px 8.5px; \"\u003e\"Renee\"\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 8px 8.5px; transform-origin: 8px 8.5px; \"\u003e];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 68px 8.5px; tab-size: 4; transform-origin: 68px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eruns = [6;18;20];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 64px 8.5px; tab-size: 4; transform-origin: 64px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003efours = [0;2;3];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 64px 8.5px; tab-size: 4; transform-origin: 64px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esixes = [0;0;1];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 216px 8.5px; tab-size: 4; transform-origin: 216px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esortednames = sortbyrundistance(name,runs,fours,sixes)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 56px 8.5px; tab-size: 4; transform-origin: 56px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esortednames = \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 72px 8.5px; tab-size: 4; transform-origin: 72px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 12px 8.5px; transform-origin: 12px 8.5px; \"\u003e  3\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(255, 0, 0); border-block-start-color: rgb(255, 0, 0); border-bottom-color: rgb(255, 0, 0); border-inline-end-color: rgb(255, 0, 0); border-inline-start-color: rgb(255, 0, 0); border-left-color: rgb(255, 0, 0); border-right-color: rgb(255, 0, 0); border-top-color: rgb(255, 0, 0); caret-color: rgb(255, 0, 0); color: rgb(255, 0, 0); column-rule-color: rgb(255, 0, 0); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(255, 0, 0); perspective-origin: 4px 8.5px; text-decoration-color: rgb(255, 0, 0); text-emphasis-color: rgb(255, 0, 0); transform-origin: 4px 8.5px; \"\u003e×\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 36px 8.5px; transform-origin: 36px 8.5px; \"\u003e1 string \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003earray\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 36px 8.5px; tab-size: 4; transform-origin: 36px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e\"Ben\"\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 40px 8.5px; tab-size: 4; transform-origin: 40px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e\"Matt\"\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 44px 8.5px; tab-size: 4; transform-origin: 44px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003e    \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 28px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 28px 8.5px; \"\u003e\"Renee\"\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374px 8px; transform-origin: 374px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHere, Matt has run 6 runs, Ben 10 (8 of his total 18 came from 4s), Renee 2 (18 of her 20 runs came from boundaries).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA batter's score is the total of runs physically run and runs scored from boundaries (hitting the ball to the boundary scores an automatic 4 runs, hitting it over the boundary scores an automatic 6 runs). The score is typically reported as the total runs scored, along with the number of boundary 4s and 6s. In the above example, Ben's score is 18 runs (total), including 2 4s and 0 6s. Hence, his score was 10 runs he actually ran, plus 8 runs from boundaries.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function name = sortbyrundistance(name,runs,fours,sixes)\r\nname = sort(name);\r\nend","test_suite":"%% Farewell, Little Master\r\nname = [\"Murali Vijay\";\"Shikhar Dhawan\";\"Cheteshwar Pujara\";\"Sachin Tendulkar\";\"Virat Kohli\";\"Rohit Sharma\";\"MS Dhoni\";\"Ravichandran Ashwin\";\"Bhuvneshwar Kumar\";\"Pragyan Ojha\";\"Mohammed Shami\"];\r\nruns = [43;33;113;74;57;111;4;30;4;0;11];\r\nfours = [8;7;12;12;5;11;0;4;1;0;2];\r\nsixes = [0;0;0;0;0;3;0;1;0;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Cheteshwar Pujara\";\"Rohit Sharma\";\"Virat Kohli\";\"Sachin Tendulkar\";\"Murali Vijay\";\"Ravichandran Ashwin\";\"Shikhar Dhawan\";\"MS Dhoni\";\"Mohammed Shami\";\"Bhuvneshwar Kumar\";\"Pragyan Ojha\"]) )\r\n%% IPL 2022\r\nname = [\"Yashasvi Jaiswal\";\"Jos Buttler\";\"Sanju Samson\";\"Devdutt Padikkal\";\"Shimron Hetmyer\";\"Ravichandran Ashwin\";\"Riyan Parag\";\"Trent Boult\";\"Obed McCoy\";\"Prasidh Krishna\"];\r\nruns = [22;39;14;2;11;6;15;11;8;0];\r\nfours = [1;5;2;0;2;0;1;0;0;0];\r\nsixes = [2;0;0;0;0;0;0;1;1;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Jos Buttler\";\"Riyan Parag\";\"Yashasvi Jaiswal\";\"Sanju Samson\";\"Ravichandran Ashwin\";\"Trent Boult\";\"Shimron Hetmyer\";\"Devdutt Padikkal\";\"Obed McCoy\";\"Prasidh Krishna\"]) )\r\n%% Inaugural WTC\r\nname = [\"Tom Latham\";\"Devon Conway\";\"Kane Williamson\";\"Ross Taylor\";\"Henry Nicholls\";\"BJ Watling\";\"Colin de Grandhomme\";\"Kyle Jamieson\";\"Tim Southee\";\"Neil Wagner\";\"Trent Boult\"];\r\nruns = [30;54;49;11;7;1;13;21;30;0;7];\r\nfours = [3;6;6;2;1;0;1;0;1;0;1];\r\nsixes = [0;0;0;0;0;0;0;1;2;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Devon Conway\";\"Kane Williamson\";\"Tom Latham\";\"Kyle Jamieson\";\"Tim Southee\";\"Colin de Grandhomme\";\"Ross Taylor\";\"Henry Nicholls\";\"Trent Boult\";\"BJ Watling\";\"Neil Wagner\"]) )\r\n%% Don Debut\r\nname = [\"Bill Woodfull\";\"Bill Ponsford\";\"Alan Kippax\";\"Stork Hendry\";\"Charles Kelleway\";\"Jack Ryder\";\"Donald Bradman\";\"Bert Oldfield\";\"Clarrie Grimmett\";\"Bert Ironmonger\"];\r\nruns = [0;2;16;30;8;33;18;2;7;4];\r\nfours = [0;0;3;4;1;3;4;0;1;0];\r\nsixes = [0;0;0;0;0;0;0;0;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Jack Ryder\";\"Stork Hendry\";\"Alan Kippax\";\"Charles Kelleway\";\"Bert Ironmonger\";\"Clarrie Grimmett\";\"Bill Ponsford\";\"Donald Bradman\";\"Bert Oldfield\";\"Bill Woodfull\"]) )\r\n%% T20 WC 2022 Subcontinental Heart Attack\r\nname = [\"Mohammad Rizwan\";\"Babar Azam\";\"Shan Masood\";\"Iftikhar Ahmed\";\"Shadab Khan\";\"Haider Ali\";\"Mohammad Nawaz\";\"Asif Ali\";\"Shaheen Shah Afridi\";\"Haris Rauf\"];\r\nruns = [4;0;52;51;5;2;9;2;16;6];\r\nfours = [1;0;5;2;1;0;2;0;1;0];\r\nsixes = [0;0;0;4;0;0;0;0;1;1];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Shan Masood\";\"Iftikhar Ahmed\";\"Shaheen Shah Afridi\";\"Haider Ali\";\"Asif Ali\";\"Shadab Khan\";\"Mohammad Nawaz\";\"Mohammad Rizwan\";\"Babar Azam\";\"Haris Rauf\"]) )\r\n%% Lara Breaks a Record\r\nname = [\"Phil Simmons\";\"Stuart Williams\";\"Brian Lara\";\"Jimmy Adams\";\"Keith Arthurton\";\"Shivnarine Chanderpaul\"];\r\nruns = [8;3;375;59;47;75];\r\nfours = [0;0;45;2;5;10];\r\nsixes = [0;0;0;2;0;0];\r\nsortname = sortbyrundistance(name,runs,fours,sixes);\r\nassert( isequal(sortname,[\"Brian Lara\";\"Jimmy Adams\";\"Shivnarine Chanderpaul\";\"Keith Arthurton\";\"Phil Simmons\";\"Stuart Williams\"]) )\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":287,"edited_by":287,"edited_at":"2022-11-08T15:09:23.000Z","deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-11-07T19:56:18.000Z","updated_at":"2025-12-06T06:35:55.000Z","published_at":"2022-11-08T15:09:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string vector of batters' names, a vector of the total number of runs they scored, a vector of the number of 4s they scored, and a vector of the number of 6s, return a string array of the player's names sorted according to how far they actually ran for their runs, from farthest to least. You can assume that 4s and 6s were not run at all (so the problem is equivalent to sorting according to the number of runs scored \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e from boundaries).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example,\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"165\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"324\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"Table showing runs, fours, and sixes for three batters. Matt has 6 runs, 0 fours, 0 sixes. Ben has 18 runs, 2 fours, 0 sixes. Renee has 20 runs, 3 fours, 1 six.\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[name = [\\\"Matt\\\";\\\"Ben\\\";\\\"Renee\\\"];\\nruns = [6;18;20];\\nfours = [0;2;3];\\nsixes = [0;0;1];\\n\\nsortednames = sortbyrundistance(name,runs,fours,sixes)\\nsortednames = \\n  3×1 string array\\n    \\\"Ben\\\"\\n    \\\"Matt\\\"\\n    \\\"Renee\\\"]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHere, Matt has run 6 runs, Ben 10 (8 of his total 18 came from 4s), Renee 2 (18 of her 20 runs came from boundaries).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA batter's score is the total of runs physically run and runs scored from boundaries (hitting the ball to the boundary scores an automatic 4 runs, hitting it over the boundary scores an automatic 6 runs). The score is typically reported as the total runs scored, along with the number of boundary 4s and 6s. In the above example, Ben's score is 18 runs (total), including 2 4s and 0 6s. Hence, his score was 10 runs he actually ran, plus 8 runs from boundaries.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.png\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQ8AAAKTCAMAAACAZA4rAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEaUExURQAAAABSewBMhwBNhgBLiABKhwBLhgAAAABLhwYHCAgICAsOEBAQEBBWjhEVGBZelhccIBddlhgYGBwjKCAgICBhliBiliIqMCJmnSJnnigoKCgxOC04QC1wpTAwMDBtnTBtnjM/SDg4ODhGUD5NWD94pUBAQEB4pUOCtEODtERUYEhISElbaE9icFBQUFVoeFhYWFpvf1qVw192h1+PtGBgYGV8j2Wey2hoaGuDl3BwcHCKn3aRp3h4eHyYr39/f3+lw4Gft4eHh4emv4e54Yytx4+Pj4+wy5K0z5eXl5i7153C35+fn6PJ56enp6nQ767X96+vr7Te/7e3t7+/v7/S4cfHx8/Pz9fX19/f3+fn5+/v7/f39////8eGjJwAAAAHdFJOUwAfQExYZHAd7kVNAAAACXBIWXMAADLAAAAywAEoZFrbAABT7ElEQVR4Xu2de3/UyJKmz84501rbLMsadtg1PuxwGc8cLg0eBgYaGgY8sDQ3G+PlYpvv/zVWIUVKmSqpKlNvGFPK9/mrKktdbfSLepSZEZn5p//yS8mf/46M5i9yB/U1GcPflzfw7/U1GYOE4F/0NRnBn+UO/pc//elPv/xXQgghv9CHhBBSQR8SQkgNfUgIITXiw7/Ii3/5VzKav8od1NdkDP+9vIH/XV+TMUgI/lVfkxH8i9zBv5Q+/Dt58Z/7ZDRVMOprMgZ5ovxVX5MxSAj+q74mI/hPuYN/Rx8aQB+i0IcoEoL0IQB9aAZ9iEIfokgI0ocA9KEZ9CEKfYgiIUgfAtCHZtCHKPQhioQgfQhAH5pBH6LQhygSgvQhAH1oBn2IQh+iSAjShwD0oRn0IQp9iCIhSB8C0Idm0Ico9CGKhCB9CEAfmkEfotCHKBKC9CEAfWgGfYhCH6JICNKHAPShGfQhC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QQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhPww/vSn/w+Hk269rvlYfAAAAABJRU5ErkJggg==\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46576,"title":"Award medals to winners","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 246.167px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 123.083px; transform-origin: 407px 123.083px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8.16667px; transform-origin: 384px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 102.167px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 51.0833px; transform-origin: 391px 51.0833px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 362.483px 8.16667px; transform-origin: 362.483px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 190.967px 8.16667px; transform-origin: 190.967px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 40.8667px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 20.4333px; text-align: left; transform-origin: 363px 20.4333px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 347.725px 8.16667px; transform-origin: 347.725px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 360.817px 8.16667px; transform-origin: 360.817px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 145.983px 8.16667px; transform-origin: 145.983px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eP.S.: For a competition with different rules, see \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46573\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 8.16667px; transform-origin: 1.94167px 8.16667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [w1,w2,w3] = medalists(x)\r\n   w1 = ...;   %  Gold\r\n   w2 = ...;   %  Silver\r\n   w3 = ...;   %  Bronze\r\nend","test_suite":"%%\r\nx = [1 5 2 6 3 7];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,4,2);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([4 6],[],[5]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [33 33 33 12 20 14 50 33 50 8 1];\r\n[w1_correct,w2_correct,w3_correct] = deal([7 9],[],[1 2 3 8]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal([1 4 10],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 10 3 4 2 3 9];\r\n[w1_correct,w2_correct,w3_correct] = deal(6,[1 4 11],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%%\r\nx = [9 8 8 9 1 3 4 2 3 9 0 -1 15 pi 12];\r\n[w1_correct,w2_correct,w3_correct] = deal(13,15,[1 4 10]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))\r\n\r\n%% \r\nx = [1 5 2 5 3 5 4 5];\r\n[w1_correct,w2_correct,w3_correct] = deal([2 4 6 8],[],[]);\r\n[w1,w2,w3] = medalists(x);\r\nassert(isequal(w1,w1_correct) \u0026\u0026 isequal(w2,w2_correct) \u0026\u0026 isequal(w3,w3_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":"2020-10-02T21:23:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-06T22:20:31.000Z","updated_at":"2020-10-02T21:23:33.000Z","published_at":"2020-09-06T22:40:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA competition awards medals to the winners: gold to first place, silver to second place, and bronze to third place. In the case of ties, these rules apply:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two competitors tie for gold, the next competitor gets bronze, and no silver is awarded. If three or more competitors tie for gold, no other medals are awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for silver, no bronze is awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf two or more competitors tie for bronze and fewer than three medals have been awarded so far, all who tied for bronze get medals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes a vector of scores and identifies the winners (i.e., the position of the winning scores in the vector).  In this competition, higher scores are better. If a medal is not awarded, set the output to the empty set. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eP.S.: For a competition with different rules, see \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46573-determine-the-winner-of-a-goofy-golf-tournament\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46573\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":44261,"title":"Multivariate polynomials - sort monomials","description":"In \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44260-multidimensional-polynomials-convert-monomial-form-to-array Problem 44260\u003e, multivariate polynomials were defined as a sum of monomial terms using|exponents|, a matrix of integers, and|coefficients|, a vector (follow the above link for an explanation).  It can be useful to order the monomials. But first we need to define the total degree of a monomial as the sum of the exponents. For example, the total degree of |5*x| is 1 and the total degree of |x^3*y^5*z| is 9.\r\n\r\nWrite a function \r\n\r\n  function [coeffs,exponents] = sortMonomials(coeffs,exponents)\r\n\r\nto sort the monomials. Sort them first by descending total degree, and then for a given total degree, by lexicographical order of the exponents (by the first exponent, then the second, and so on, each in descending order). The coefficients should be sorted so they stay with the correct monomial.\r\n\r\nExample: Consider the polynomial |p(x,y,z) = 3*x - 2 + y^2 +4*z^2|, which is represented as:\r\n\r\n  exponents = [1 0 0; 0 0 0; 0 2 0; 0 0 2], coefficients = [3; -2; 1; 4]\r\n\r\nThe sorted version is\r\n\r\n  exponents = [0 2 0; 0 0 2; 1 0 0; 0 0 0], coefficients = [1; 3; 1; 4].\r\n\r\nYou can assume that a given combination of exponents is never repeated.","description_html":"\u003cp\u003eIn \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44260-multidimensional-polynomials-convert-monomial-form-to-array\"\u003eProblem 44260\u003c/a\u003e, multivariate polynomials were defined as a sum of monomial terms using|exponents|, a matrix of integers, and|coefficients|, a vector (follow the above link for an explanation).  It can be useful to order the monomials. But first we need to define the total degree of a monomial as the sum of the exponents. For example, the total degree of \u003ctt\u003e5*x\u003c/tt\u003e is 1 and the total degree of \u003ctt\u003ex^3*y^5*z\u003c/tt\u003e is 9.\u003c/p\u003e\u003cp\u003eWrite a function\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003efunction [coeffs,exponents] = sortMonomials(coeffs,exponents)\r\n\u003c/pre\u003e\u003cp\u003eto sort the monomials. Sort them first by descending total degree, and then for a given total degree, by lexicographical order of the exponents (by the first exponent, then the second, and so on, each in descending order). The coefficients should be sorted so they stay with the correct monomial.\u003c/p\u003e\u003cp\u003eExample: Consider the polynomial \u003ctt\u003ep(x,y,z) = 3*x - 2 + y^2 +4*z^2\u003c/tt\u003e, which is represented as:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eexponents = [1 0 0; 0 0 0; 0 2 0; 0 0 2], coefficients = [3; -2; 1; 4]\r\n\u003c/pre\u003e\u003cp\u003eThe sorted version is\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eexponents = [0 2 0; 0 0 2; 1 0 0; 0 0 0], coefficients = [1; 3; 1; 4].\r\n\u003c/pre\u003e\u003cp\u003eYou can assume that a given combination of exponents is never repeated.\u003c/p\u003e","function_template":"function [coeffs,exponents] = sortMonomials(coeffs,exponents)\r\ncoeffs = 0;\r\nexponents = 0;\r\nend","test_suite":"%% Test sortMonomials\r\nfiletext = fileread('sortMonomials.m');\r\nassert(~contains(filetext,'regexp'))\r\n\r\n%%\r\nunsortedCoeffs = [-10 7 -10 -7 6 6 3 1 -7 2]';\r\nunsortedExponents = [5 4 2; 2 5 3; 2 1 5; 1 5 4; 1 4 3; 1 3 3; 1 2 1; 0 4 1; 0 2 1; 0 0 5];\r\n[sortedCoeffs,sortedExponents] = sortMonomials(unsortedCoeffs,unsortedExponents);\r\nsortOrder = [1 2 4 3 5 6 8 10 7 9];\r\nassert(isequal(sortedCoeffs,unsortedCoeffs(sortOrder)))\r\nassert(isequal(sortedExponents,unsortedExponents(sortOrder,:)))\r\n\r\n%%\r\nx = randi(1000); y = randi(1000);\r\n[coeffs,exponents] = sortMonomials(x,y);\r\nassert(isequal([x y],[coeffs exponents]))\r\n\r\n%%\r\nunsortedCoeffs = randi(1000,[4 1]);\r\nough = ['hguot '; 'hguoc '; 'hguolp'; 'hguod '];\r\nunsortedExponents = ough - repmat(randi(100),size(ough));\r\nunsortedExponents = [unsortedExponents -sum(unsortedExponents,2)];\r\n[sortedCoeffs,~] = sortMonomials(unsortedCoeffs,unsortedExponents);\r\n[~,ia] = sort(ough(:,5));\r\nassert(isequal(sortedCoeffs,flipud(unsortedCoeffs(ia))))\r\n\r\n%%\r\nz = [1 3 5+randi(10)];\r\nv1 = perms(z); \r\nv2 = perms(z+[1 0 0]);\r\nv = [v2; v1];\r\nunsortedCoeffs = randi(1000,[size(v,1) 1]);\r\nunsortedExponents = v(randperm(size(v,1)),:);\r\n[sortedCoeffs,sortedExponents] = sortMonomials(unsortedCoeffs,unsortedExponents);\r\nassert(isequal(sortedExponents,v))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":1011,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-07-13T18:24:47.000Z","updated_at":"2017-07-15T05:42:59.000Z","published_at":"2017-07-13T18:25:15.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44260-multidimensional-polynomials-convert-monomial-form-to-array\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44260\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, multivariate polynomials were defined as a sum of monomial terms using|exponents|, a matrix of integers, and|coefficients|, a vector (follow the above link for an explanation). It can be useful to order the monomials. But first we need to define the total degree of a monomial as the sum of the exponents. For example, the total degree of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e5*x\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is 1 and the total degree of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ex^3*y^5*z\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is 9.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[function [coeffs,exponents] = sortMonomials(coeffs,exponents)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eto sort the monomials. Sort them first by descending total degree, and then for a given total degree, by lexicographical order of the exponents (by the first exponent, then the second, and so on, each in descending order). The coefficients should be sorted so they stay with the correct monomial.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample: Consider the polynomial\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ep(x,y,z) = 3*x - 2 + y^2 +4*z^2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, which is represented as:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[exponents = [1 0 0; 0 0 0; 0 2 0; 0 0 2], coefficients = [3; -2; 1; 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe sorted version is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[exponents = [0 2 0; 0 0 2; 1 0 0; 0 0 0], coefficients = [1; 3; 1; 4].]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou can assume that a given combination of exponents is never repeated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2344,"title":"N-Dimensional Sorting","description":"Given two N-dimensional matrices A and B, first sort A in increasing order and then sort B with respect to the index of A.\r\n \r\nYou produce sorted B as output. Normally the sort command does not work as the dimension increases. You must find a way to apply the sort command to an N-dimensional matrix.\r\n\r\nExample \r\n\r\n A(:,:,1) =\r\n\r\n    33    29\r\n    26    28\r\n\r\n\r\n A(:,:,2) =\r\n\r\n    13    35\r\n    22     3\r\n\r\n\r\n B(:,:,1) =\r\n\r\n    31    55\r\n    26    38\r\n\r\n\r\n B(:,:,2) =\r\n\r\n    59    51\r\n    36    29\r\n\r\n\r\n Bsorted(:,:,1) =\r\n\r\n    26    38\r\n    31    55\r\n\r\n\r\n Bsorted(:,:,2) =\r\n\r\n    59    29\r\n    36    51","description_html":"\u003cp\u003eGiven two N-dimensional matrices A and B, first sort A in increasing order and then sort B with respect to the index of A.\u003c/p\u003e\u003cp\u003eYou produce sorted B as output. Normally the sort command does not work as the dimension increases. You must find a way to apply the sort command to an N-dimensional matrix.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e A(:,:,1) =\u003c/pre\u003e\u003cpre\u003e    33    29\r\n    26    28\u003c/pre\u003e\u003cpre\u003e A(:,:,2) =\u003c/pre\u003e\u003cpre\u003e    13    35\r\n    22     3\u003c/pre\u003e\u003cpre\u003e B(:,:,1) =\u003c/pre\u003e\u003cpre\u003e    31    55\r\n    26    38\u003c/pre\u003e\u003cpre\u003e B(:,:,2) =\u003c/pre\u003e\u003cpre\u003e    59    51\r\n    36    29\u003c/pre\u003e\u003cpre\u003e Bsorted(:,:,1) =\u003c/pre\u003e\u003cpre\u003e    26    38\r\n    31    55\u003c/pre\u003e\u003cpre\u003e Bsorted(:,:,2) =\u003c/pre\u003e\u003cpre\u003e    59    29\r\n    36    51\u003c/pre\u003e","function_template":"function Bsorted = N_Dim_sort(A,B)\r\n \r\nBsorted=A,B\r\nend","test_suite":"%%\r\nA(:,:,1) =[33    29\r\n    26    28]\r\n\r\n A(:,:,2) =[ 13    35\r\n    22     3]\r\n\r\n B(:,:,1) =[31    55\r\n    26    38]\r\n\r\n B(:,:,2) =[59    51\r\n    36    29]\r\n\r\n Bsorted(:,:,1) =[26    38\r\n    31    55]\r\n\r\n Bsorted(:,:,2) =[59    29\r\n    36    51]\r\n\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA(:,:,1) =[22    21    21     9    10\r\n     8    28     5     4     8\r\n    26    23    22    39     4\r\n    39    20    28     1    15\r\n    22    13     6     5     1\r\n    20    25    32     1    25\r\n    32    37    16     9    20\r\n     4    28    36     1    13\r\n    36    38    13    26    30\r\n     1     4     3    21    34]\r\n\r\n\r\nA(:,:,2) =[11    14    34    14    38\r\n    21    11    16    12    25\r\n    18    23     7    36    16\r\n    14     8    18     9    27\r\n    34    28    17     6    32\r\n    40     3    30    21    14\r\n    26     2    17    37    28\r\n     8    12    39    17     9\r\n     5     4    37     9    39\r\n    24    37    39     4    29]\r\n\r\n\r\nB(:,:,1) =[11    19    50    22     1\r\n    27    42     7     2    44\r\n    38    54    17    31    24\r\n    56    30    47    50     3\r\n    32    49    13    16    25\r\n    38    20     3     3    43\r\n    41    33    27    15    56\r\n    56    24    57    40    60\r\n    10    54    16    20    60\r\n    25    41    35    40    54]\r\n\r\n\r\nB(:,:,2) =[52    23    35    18     4\r\n    49    17    49    45     8\r\n    34    10    40     7    28\r\n    26    38    53    48    41\r\n     8    19    55    47    52\r\n    40    58    10    32    30\r\n    52    30    12    16     3\r\n    17    45    48     5    19\r\n    51     1     4    38    39\r\n     5    37    24     2    48]\r\n\r\n\r\nBsorted(:,:,1) =[25    41    35    50    25\r\n    56    49     7     3    24\r\n    27    30    13    40    44\r\n    38    19    16     2     1\r\n    11    54    27    16    60\r\n    32    20    50    22     3\r\n    38    42    17    15    56\r\n    41    24    47    40    43\r\n    10    33     3    20    60\r\n    56    54    57    31    54]\r\n\r\n\r\nBsorted(:,:,2) =[51    30    40     2    19\r\n    17    58    49    47    30\r\n    52     1    55    48    28\r\n    26    38    12    38     8\r\n    34    17    53    45    41\r\n    49    45    10    18     3\r\n     5    23    35     5    48\r\n    52    10     4    32    52\r\n     8    19    48     7     4\r\n    40    37    24    16    39]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA(:,:,1) =[1    13     3    33    27\r\n    16    23    26     6    15\r\n    36    20    14     5    25\r\n     1    10    23    40     7\r\n     5    40     1    34     6\r\n     8    40     3    29     6\r\n    26    34    31     8    39\r\n    20    31     3     3    25\r\n     9    33    21     4    13\r\n    22    26     8    32    12\r\n    28     6    31    13     5\r\n    30    37    24    27    29\r\n    33    11    36    32    35\r\n    37    40    33    25     1\r\n    35    19    27    23    28\r\n    22    26    25    34     7\r\n     8    27    40    19    23\r\n    22     3    24     8    31\r\n    36     2    20     1     7\r\n    22    12    27    37    20]\r\n\r\n\r\nA(:,:,2) =[ 3    17    30    20    10\r\n     5    30    16    23    31\r\n    27    18    20    29    10\r\n    20    28    29    13    27\r\n    20    37    40    26     6\r\n    15    32    34    17    22\r\n     6    19    40    26     9\r\n    29    18    39    10    21\r\n     1     1    25    31    21\r\n     7    35    10    20    22\r\n     7    18    39    14    33\r\n    38    29    39     6    32\r\n    29    15    27    26    25\r\n     7    32    17    19    38\r\n    13    25     4     2    27\r\n    28    22     5    21     4\r\n    19    25    39     1     3\r\n     1     6    38     1    32\r\n    14    28    34    24    17\r\n    32    20     1    29    10]\r\n\r\n\r\nA(:,:,3) =[31    20    16    26    16\r\n    23    18     9    11     2\r\n    27    16     2     5    27\r\n     6    18    10    37    32\r\n    25    31    10     2    39\r\n    22    18     8    15    23\r\n    38     1    34    23    27\r\n     1    11    25    19     9\r\n     4    20    29    21    21\r\n    27    25    22    19    26\r\n    19    12    16    30    14\r\n    15    14    20    27    24\r\n    20     5    14    40     7\r\n    10    31    26    39     4\r\n    13    19    38    19    24\r\n     4    25    26     4    15\r\n    37    23    25    36     9\r\n    23    28    30     9     3\r\n     6    21    24    39    20\r\n    20     6    36    37    29]\r\n\r\n\r\nA(:,:,4) =[10    23     2    33    20\r\n     8    11     8    36    34\r\n     3     3    34     6     3\r\n    18     8     7    39    14\r\n    10    16    14    17    17\r\n    18    37    16     7    13\r\n    30     9    27     7    23\r\n     9     3    18    23    19\r\n    25    15    24     8    31\r\n    14    34     8    12    28\r\n     5    40    15    30    29\r\n    33     9    16    39    20\r\n     3    29    21    26    19\r\n    26    40    33     9    21\r\n    32    39     4     6    16\r\n     1     4     9     2    37\r\n    11     3    31    15    26\r\n    40    19    36     8    34\r\n    27    27    36     2    26\r\n    13     5    38    27     7]\r\n\r\n\r\nB(:,:,1) =[7    56    21    23    25\r\n    19    11    31    37     5\r\n    21    23    32    58    52\r\n    44    39    56    60    22\r\n    46    29    15     5    52\r\n    28     7    40    14    20\r\n    45    42    36    17    42\r\n    50    17    15    49    39\r\n    58    40    12    59    34\r\n    38    50     3     1    56\r\n     3    37    32    29    36\r\n     7     4    40    29    25\r\n    46    35    20     8    32\r\n    19    58    11    22    53\r\n    54    21    10    30    28\r\n    50    50     3    49    27\r\n    12     5    14    41    36\r\n    53    34    35     2     5\r\n    15    57    25     8     3\r\n    49    31    10    39    18]\r\n\r\n\r\nB(:,:,2) =[46     6    48    57    52\r\n    47     1    13    26    32\r\n     6    57    34    31    37\r\n    19    44    36     4    13\r\n    13    50    33    53    46\r\n     1     9    21    20    16\r\n    39    43     9    30    42\r\n    43    42    16    37    38\r\n    47    23    41    36    33\r\n    51    35    33    19    45\r\n    41    23    19    43    56\r\n    42    38    51    47    54\r\n    49    42    24    60    43\r\n     1    23    14    30    44\r\n    53    23     6    32    44\r\n    27    21     8    41    40\r\n    50    47    17     6    20\r\n    50     7    50     7    31\r\n    53    41    40    26    27\r\n    17    55    57    19     4]\r\n\r\n\r\nB(:,:,3) =[46    48    58    50    26\r\n     5     3    45    36    26\r\n    10    59    59    30    49\r\n    49    31    37     7    43\r\n    51    11    36     7     8\r\n    14     3    48    30    46\r\n     8    17    23    53    32\r\n     6     4    48     6    45\r\n    13    48    18    42    22\r\n    19    12    34     8    60\r\n     2    25    56    43    32\r\n    47     6    38    28    47\r\n    17    48     7    31     2\r\n    18    22    11    53    15\r\n    17    55    11     3    43\r\n    34    12    48    52    27\r\n    30    34    17    24    30\r\n    45    10     5     8    12\r\n    58    13    51    40    15\r\n     8    40     8    17     5]\r\n\r\n\r\nB(:,:,4) =[56    19    59     4    50\r\n    17    20    26    22    17\r\n    60    12    58    17    49\r\n    55     9    28    27    27\r\n    40    11     5    22    26\r\n    37    15    44    50    45\r\n    35    16    12    31    59\r\n    15    43    45    21    43\r\n    19    33    36    54    30\r\n    27    49     8    30    52\r\n    29    27     6    59    13\r\n    33    22    41    43    43\r\n    53    13    26    53    21\r\n    28    54    16    36    10\r\n    40     3    24    25    43\r\n    60    20    19    38    56\r\n     5     9    21    26    47\r\n    25    37    32    18    55\r\n    35    56    14    47    22\r\n    47    25    60    50     3]\r\n\r\n\r\nBsorted(:,:,1) =[7    57    15     8    53\r\n    44    34    21    49    36\r\n    46    37    40    59    52\r\n    28    39    15    58    20\r\n    12    35     3    37    22\r\n    58    31    32    17    27\r\n    19    56    25     2     3\r\n    50    21    12    29    56\r\n    38    23    56    41    34\r\n    50    11    40    30     5\r\n    53    50    35    22    18\r\n    49    50     3    29    36\r\n    45     5    31    14    52\r\n     3    17    10     1    39\r\n     7    40    10     8    25\r\n    46    42    36    23    28\r\n    54     4    32     5    25\r\n    21    29    11    49     5\r\n    15     7    20    39    32\r\n    19    58    14    60    42]\r\n\r\n\r\nBsorted(:,:,2) =[47    23    57     6    20\r\n    50     7     6     7    40\r\n    46    42     8    32    46\r\n    47     6    33    47    42\r\n    39    57    13    37    52\r\n    51    42    14     4    37\r\n    41    23    34    43     4\r\n     1    43    41    20    27\r\n    53    55    24    30    38\r\n    53    21    36    57    33\r\n     1    23    48    19    16\r\n    50    47    21    41    45\r\n    19    44    40    26    43\r\n    13    41    50    26    13\r\n     6    38    16    53    44\r\n    27     1    19    30    32\r\n    43     9    51    60    54\r\n    49    23    17    31    31\r\n    17    35    33    19    56\r\n    42    50     9    36    44]\r\n\r\n\r\nBsorted(:,:,3) =[6    17    59     7    26\r\n    13    48    48    52    12\r\n    34    40    45    30    15\r\n    49     4    37     8     2\r\n    58    25    36    36    45\r\n    18     6     7    30    30\r\n    17    59    58     6    32\r\n    47     3    56     8    27\r\n     2    31    38     3    26\r\n    17     3    34    42    15\r\n     8    55    51    53    22\r\n    14    48    48    50    46\r\n     5    48    17    28    47\r\n    45    13    11    43    43\r\n    51    34    48    24    60\r\n    10    12    18     7    49\r\n    19    12     5    17    32\r\n    46    10    23    53     5\r\n    30    11     8    40    43\r\n     8    22    11    31     8]\r\n\r\n\r\nBsorted(:,:,4) =[60    12    59    38    49\r\n    60    43    24    47     3\r\n    53     9    28    17    45\r\n    29    20    26    25    27\r\n    17    25     8    50    43\r\n    15     9    19    31    26\r\n    56    16     5    54    43\r\n    40    22     6    18    21\r\n     5    20    44    36    50\r\n    47    33    41    30    43\r\n    27    11    45    26    10\r\n    55    37    26    22    59\r\n    37    19    36    21    47\r\n    19    56    12    53    22\r\n    28    13    21    50    52\r\n    35    49    16    59    13\r\n    35    15    58     4    30\r\n    40     3    32    22    17\r\n    33    27    14    27    55\r\n    25    54    60    43    56]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA =[26    11     7     4    19\r\n    25    23    10    14    40\r\n    35    38    32    40    14\r\n    12    38    21    20    28\r\n    10     7    40    19    15]\r\n\r\n\r\nB =[48    30    24     7    54\r\n     4     5    47    30    51\r\n     7    25    27    49    22\r\n    45    11    42     5    10\r\n    20    20    60    38    33]\r\n\r\n\r\nBsorted =[20    20    24     7    22\r\n    45    30    47    30    33\r\n     4     5    42    38    54\r\n    48    25    27     5    10\r\n     7    11    60    49    51]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))\r\n%%\r\nA(:,:,1) =[2    39    20    12\r\n    18    29    22     7]\r\n\r\n\r\nA(:,:,2) =[27    39    36    15\r\n    21    26    34    31]\r\n\r\n\r\nB(:,:,1) =[26    14     9    27\r\n    54    35     7    41]\r\n\r\n\r\nB(:,:,2) =[25    59    16    13\r\n    20    41    41    27]\r\n\r\n\r\nBsorted(:,:,1) =[26    35     9    41\r\n    54    14     7    27]\r\n\r\n\r\nBsorted(:,:,2) =[20    41    41    13\r\n    25    59    16    27]\r\nassert(isequal(N_Dim_sort(A,B),Bsorted))","published":true,"deleted":false,"likes_count":0,"comments_count":7,"created_by":22216,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-06-03T16:02:21.000Z","updated_at":"2026-03-16T14:19:46.000Z","published_at":"2014-06-03T16:22:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven two N-dimensional matrices A and B, first sort A in increasing order and then sort B with respect to the index of A.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou produce sorted B as output. Normally the sort command does not work as the dimension increases. You must find a way to apply the sort command to an N-dimensional matrix.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ A(:,:,1) =\\n\\n    33    29\\n    26    28\\n\\n A(:,:,2) =\\n\\n    13    35\\n    22     3\\n\\n B(:,:,1) =\\n\\n    31    55\\n    26    38\\n\\n B(:,:,2) =\\n\\n    59    51\\n    36    29\\n\\n Bsorted(:,:,1) =\\n\\n    26    38\\n    31    55\\n\\n Bsorted(:,:,2) =\\n\\n    59    29\\n    36    51]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42809,"title":"Sorting integers by their digits (Level 1)","description":"Given a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nExample:\r\n\r\nv = [14 3 268 14 210 1 80];\r\n\r\nw = [1 14 14 210 268 3 80];\r\n\r\nAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.","description_html":"\u003cp\u003eGiven a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14 3 268 14 210 1 80];\u003c/p\u003e\u003cp\u003ew = [1 14 14 210 268 3 80];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14 3 268 14 210 1 80];\r\nw_correct = [1 14 14 210 268 3 80];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [246 24680 2468 246 24 2 24680 24 2468 2];\r\nw_correct = [2 2 24 24 246 246 2468 2468 24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":86,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-19T20:04:25.000Z","updated_at":"2026-03-16T16:49:45.000Z","published_at":"2016-04-19T20:04:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14 3 268 14 210 1 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [1 14 14 210 268 3 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1687,"title":"Poker Card Deal!","description":"Anyone want to play a card game?  \r\n\r\nWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards.  Rows are the amount of people in play, columns are the amount of cards dealt to each person.  The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\r\n\r\nThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J.  The suits are s for spades, d for dimonds, h for hearts and c for clubs.  \r\n\r\nSo the final cards look like this:\r\n\r\n'js'\r\n\r\n'J'\r\n\r\n'2h'\r\n\r\n'ad'\r\n\r\n'5c' and so on.\r\n\r\nThis function reads in three variables, these are:\r\n\r\npeople -- This is the amount of people that the cards are being dealt to.\r\n\r\ncardsDelt  -- This is the amount of cards dealt to each person.\r\n\r\nisJokerIn --  This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\r\n\r\nso an example is the following, if the variables are:\r\n\r\n%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\r\n\r\npeople = 5;\r\n\r\ncardsDelt = 5; %note, this is a typical deal for a poker game...\r\n\r\nisJokerIn = 0; \r\n\r\nThe outputs will be:\r\n\r\ndealtDeck = \r\n\r\n    'qh'    'as'    '5s'     '2s'    'jd' \r\n    'ad'    '5d'    '9s'     '7h'    'ah' \r\n    '3c'    '2d'    'ac'     '8c'    'qd' \r\n    'kh'    '5h'    '4c'     '3h'    '10s'\r\n    '6h'    '8h'    '10c'    '4s'    '8d' \r\n\r\n%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\r\n\r\ndeckLeftover = \r\n\r\n    '3s'\r\n    '4h'\r\n    '2c'\r\n    '5c'\r\n    'qs'\r\n    'jh'\r\n    'kd'\r\n    '2h'\r\n    '9c'\r\n    '10h'\r\n    '9h'\r\n    '6d'\r\n    '7c'\r\n    '7s'\r\n    '8s'\r\n    'qc'\r\n    'js'\r\n    '9d'\r\n    '7d'\r\n    'ks'\r\n    '6c'\r\n    '6s'\r\n    '3d'\r\n    '10d'\r\n    'jc'\r\n    '4d'\r\n    'kc'\r\n\r\nWell I hope that everyone has fun with it!  Thank you!\r\n\r\n","description_html":"\u003cp\u003eAnyone want to play a card game?\u003c/p\u003e\u003cp\u003eWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards.  Rows are the amount of people in play, columns are the amount of cards dealt to each person.  The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\u003c/p\u003e\u003cp\u003eThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J.  The suits are s for spades, d for dimonds, h for hearts and c for clubs.\u003c/p\u003e\u003cp\u003eSo the final cards look like this:\u003c/p\u003e\u003cp\u003e'js'\u003c/p\u003e\u003cp\u003e'J'\u003c/p\u003e\u003cp\u003e'2h'\u003c/p\u003e\u003cp\u003e'ad'\u003c/p\u003e\u003cp\u003e'5c' and so on.\u003c/p\u003e\u003cp\u003eThis function reads in three variables, these are:\u003c/p\u003e\u003cp\u003epeople -- This is the amount of people that the cards are being dealt to.\u003c/p\u003e\u003cp\u003ecardsDelt  -- This is the amount of cards dealt to each person.\u003c/p\u003e\u003cp\u003eisJokerIn --  This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\u003c/p\u003e\u003cp\u003eso an example is the following, if the variables are:\u003c/p\u003e\u003cp\u003e%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\u003c/p\u003e\u003cp\u003epeople = 5;\u003c/p\u003e\u003cp\u003ecardsDelt = 5; %note, this is a typical deal for a poker game...\u003c/p\u003e\u003cp\u003eisJokerIn = 0;\u003c/p\u003e\u003cp\u003eThe outputs will be:\u003c/p\u003e\u003cp\u003edealtDeck =\u003c/p\u003e\u003cpre\u003e    'qh'    'as'    '5s'     '2s'    'jd' \r\n    'ad'    '5d'    '9s'     '7h'    'ah' \r\n    '3c'    '2d'    'ac'     '8c'    'qd' \r\n    'kh'    '5h'    '4c'     '3h'    '10s'\r\n    '6h'    '8h'    '10c'    '4s'    '8d' \u003c/pre\u003e\u003cp\u003e%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\u003c/p\u003e\u003cp\u003edeckLeftover =\u003c/p\u003e\u003cpre\u003e    '3s'\r\n    '4h'\r\n    '2c'\r\n    '5c'\r\n    'qs'\r\n    'jh'\r\n    'kd'\r\n    '2h'\r\n    '9c'\r\n    '10h'\r\n    '9h'\r\n    '6d'\r\n    '7c'\r\n    '7s'\r\n    '8s'\r\n    'qc'\r\n    'js'\r\n    '9d'\r\n    '7d'\r\n    'ks'\r\n    '6c'\r\n    '6s'\r\n    '3d'\r\n    '10d'\r\n    'jc'\r\n    '4d'\r\n    'kc'\u003c/pre\u003e\u003cp\u003eWell I hope that everyone has fun with it!  Thank you!\u003c/p\u003e","function_template":"function [dealtDeck, deckLeftover] = Poker_Deal(people,cardsDelt,isJokerIn)\r\ndealtDeck ='this is the dealt deck to players'\r\ndeckLeftover = 'is the left over cards in the deck, after being delt'\r\nend","test_suite":"%%\r\npeople = 5;\r\ncardsDelt = 5;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 25) \u0026 ~issorted(reshape(dealtDeck,25,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-25)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 5;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 15) \u0026 ~issorted(reshape(dealtDeck,15,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-15)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 4;\r\ncardsDelt = 7;\r\nisJokerIn = 0;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 28) \u0026 ~issorted(reshape(dealtDeck,28,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (52-28)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 5;\r\ncardsDelt = 6;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 30) \u0026 ~issorted(reshape(dealtDeck,30,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-30)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 4;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 12) \u0026 ~issorted(reshape(dealtDeck,12,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-12)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n%%\r\npeople = 3;\r\ncardsDelt = 3;\r\nisJokerIn = 1;\r\n[dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)\r\ndeckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac';  'J'; 'J'}\r\nh = (sum(sum(ismember(deckCheck,dealtDeck))) == 9) \u0026 ~issorted(reshape(dealtDeck,9,1));\r\ng = (sum(ismember(deckCheck,deckLeftover)) == (54-9)) \u0026 ~issorted(deckLeftover);\r\ny_correct = g\u0026h;\r\nassert(isequal(g,h))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":15,"created_at":"2013-06-30T01:06:43.000Z","updated_at":"2026-04-02T19:37:49.000Z","published_at":"2013-06-30T01:06:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnyone want to play a card game?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWell this is making one deck of cards, with the option of using 2 jokers. The outputs are a matrix that represents dealt cards. Rows are the amount of people in play, columns are the amount of cards dealt to each person. The deck that is left over is where the cards were drawn from and is returned as well. That is it! No other things needed.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe cards are named with there face value, such as 2,3,4,5,6,7,8,9,10,j,q,k,a and a joker of only the capital letter J. The suits are s for spades, d for dimonds, h for hearts and c for clubs.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo the final cards look like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'js'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'J'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'2h'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'ad'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'5c' and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis function reads in three variables, these are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003epeople -- This is the amount of people that the cards are being dealt to.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecardsDelt -- This is the amount of cards dealt to each person.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eisJokerIn -- This is a true/false (that is 1 or 0), where 1 means 2 jokers (J) are included in play or 0 is no jokers are included in play.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eso an example is the following, if the variables are:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e%note this example is RANDOM, the outputs must be random to simulate a shuffled deck!!!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003epeople = 5;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ecardsDelt = 5; %note, this is a typical deal for a poker game...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eisJokerIn = 0;\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe outputs will be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edealtDeck =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    'qh'    'as'    '5s'     '2s'    'jd' \\n    'ad'    '5d'    '9s'     '7h'    'ah' \\n    '3c'    '2d'    'ac'     '8c'    'qd' \\n    'kh'    '5h'    '4c'     '3h'    '10s'\\n    '6h'    '8h'    '10c'    '4s'    '8d']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e%note, 5x5, where rows is amount of people and columns are amount of cards dealt...\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edeckLeftover =\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    '3s'\\n    '4h'\\n    '2c'\\n    '5c'\\n    'qs'\\n    'jh'\\n    'kd'\\n    '2h'\\n    '9c'\\n    '10h'\\n    '9h'\\n    '6d'\\n    '7c'\\n    '7s'\\n    '8s'\\n    'qc'\\n    'js'\\n    '9d'\\n    '7d'\\n    'ks'\\n    '6c'\\n    '6s'\\n    '3d'\\n    '10d'\\n    'jc'\\n    '4d'\\n    'kc']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWell I hope that everyone has fun with it! Thank you!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":55285,"title":"Number of leaps in binary search","description":"Binary search is one of the most popular searching algorithms (Binary Search Algorithm). It works only in a sorted array. It utilizes the concept of decrease and conquer. At each iteration, it halves the size of the array while searching for an element in a list of items.\r\nWhile Matlab provides the 'find' or similar functions to search for an element in an array. This problem works the other way around. You have to implement the binary search algorithm here. Instead of finding the index of an element, you've to find how many jumps/iterations do you need using binary search to reach the item you are looking for.\r\n\r\nFor example, \r\ngiven array, a= [2, 4,  5, 7, 8, 9, 19] and search item value= 8.\r\nThe item is located at index 5. But thats not what you are looking for.\r\nImplementing Binary search --\r\nstep - 1: mid_elem = 7. doesn't match and lower. so shift the search to upper half. new array is [8, 9, 19].\r\nstep - 2: mid_elem = 9. doesn't match and higher. so, shift the search to lower half. new array is [8].\r\nstep - 3: mid_elem=8. match.\r\nSo, no of steps =3.\r\n\r\nIf the value is not found, return -1.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 457.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 228.65px; transform-origin: 407px 228.65px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 199.5px 8px; transform-origin: 199.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBinary search is one of the most popular searching algorithms (\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Binary_search_algorithm\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eBinary Search Algorithm\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 108px 8px; transform-origin: 108px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e). It works only in a sorted array. It utilizes the concept of decrease and conquer. At each iteration, it halves the size of the array while searching for an element in a list of items.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 384px 8px; transform-origin: 384px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhile Matlab provides the 'find' or similar functions to search for an element in an array. This problem works the other way around. You have to implement the binary search algorithm here. Instead of finding the index of an element, you've to find how many jumps/iterations do you need using binary search to reach the item you are looking for.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 43px 8px; transform-origin: 43px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 194.5px 8px; transform-origin: 194.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003egiven array, a= [2, 4,  5, 7, 8, 9, 19] and search item value= 8.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 215px 8px; transform-origin: 215px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe item is located at index 5. But thats not what you are looking for.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 94px 8px; transform-origin: 94px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eImplementing Binary search --\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 61.3px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30.65px; transform-origin: 391px 30.65px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 328px 8px; transform-origin: 328px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003estep - 1: mid_elem = 7. doesn't match and lower. so shift the search to upper half. new array is [8, 9, 19].\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 311.5px 8px; transform-origin: 311.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003estep - 2: mid_elem = 9. doesn't match and higher. so, shift the search to lower half. new array is [8].\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 91px 8px; transform-origin: 91px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003estep - 3: mid_elem=8. match.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 59.5px 8px; transform-origin: 59.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSo, no of steps =3.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 107px 8px; transform-origin: 107px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIf the value is not found, return -1.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":" function step = binary_step(a,val)\r\n  step = x;\r\nend","test_suite":"%%\r\na=[2,4,5,7,8,9,19];\r\nval=7;\r\ny_correct = 1;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na=[2,4,5,7,8,9,19];\r\nval=4;\r\ny_correct = 2;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na=[2,4,5,7,8,9,19];\r\nval=8;\r\ny_correct = 3;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na=[2,4,5,7,8,9,19];\r\nval=21;\r\ny_correct = -1;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= [10,14,19,26,27,31,33,35,42,44];\r\nval=31;\r\ny_correct = 3;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= [10,14,19,26,27,31,33,35,42,44];\r\nval=33;\r\ny_correct = 4;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= [10,14,19,26,27,31,33,35,42,44,3];\r\nval=33;\r\ny_correct = 4;\r\nassert(isequal(binary_step(a,val),y_correct))\r\n\r\n%%\r\na= randperm(200);\r\nval=47;\r\ny_correct = 8;\r\nassert(isequal(binary_step(a,val),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":363598,"edited_by":223089,"edited_at":"2022-09-14T08:41:03.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2022-09-14T08:41:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-08-12T22:28:58.000Z","updated_at":"2025-10-01T23:09:27.000Z","published_at":"2022-08-12T22:34:00.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBinary search is one of the most popular searching algorithms (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Binary_search_algorithm\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBinary Search Algorithm\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e). It works only in a sorted array. It utilizes the concept of decrease and conquer. At each iteration, it halves the size of the array while searching for an element in a list of items.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhile Matlab provides the 'find' or similar functions to search for an element in an array. This problem works the other way around. You have to implement the binary search algorithm here. Instead of finding the index of an element, you've to find how many jumps/iterations do you need using binary search to reach the item you are looking for.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven array, a= [2, 4,  5, 7, 8, 9, 19] and search item value= 8.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe item is located at index 5. But thats not what you are looking for.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImplementing Binary search --\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estep - 1: mid_elem = 7. doesn't match and lower. so shift the search to upper half. new array is [8, 9, 19].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estep - 2: mid_elem = 9. doesn't match and higher. so, shift the search to lower half. new array is [8].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estep - 3: mid_elem=8. match.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo, no of steps =3.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf the value is not found, return -1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":42815,"title":"Sorting integers by their digits (Level 3)","description":"This is the next step up from \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level-2 Problem 42811\u003e.\r\n\r\nGiven a vector, v, of real numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nExample:\r\n\r\nv = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\r\n\r\nw = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\r\n\r\nAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\r\n\r\nNegative numbers take precedence over positive numbers.","description_html":"\u003cp\u003eThis is the next step up from \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level-2\"\u003eProblem 42811\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eGiven a vector, v, of real numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\u003c/p\u003e\u003cp\u003ew = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/p\u003e\u003cp\u003eNegative numbers take precedence over positive numbers.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\r\nw_correct = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-246 -24680 2468 246 24 -2 24680 -24 -2468 2];\r\nw_correct = [-2 2 -24 24 -246 246 -2468 2468 -24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-0.22222 0.22 0.222 0.2 0.2222];\r\nw_correct = [0.2 0.22 0.222 0.2222 -0.22222];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-20T19:57:51.000Z","updated_at":"2026-03-12T02:58:05.000Z","published_at":"2016-04-20T19:57:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the next step up from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 42811\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of real numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14.38 80.42 3.14 268 -14.38 210 1 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [1 -14.38 14.38 210 268 3.14 80.42 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNegative numbers take precedence over positive numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":30,"title":"Sort a list of complex numbers based on far they are from the origin.","description":"Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear first.\n\nSo if z is\n\n z = [-4 6 3+4i 1+i 0]\n\nthen the output zSorted would be\n\n zSorted = [6 3+4i -4 1+i 0]","description_html":"\u003cp\u003eGiven a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear first.\u003c/p\u003e\u003cp\u003eSo if z is\u003c/p\u003e\u003cpre\u003e z = [-4 6 3+4i 1+i 0]\u003c/pre\u003e\u003cp\u003ethen the output zSorted would be\u003c/p\u003e\u003cpre\u003e zSorted = [6 3+4i -4 1+i 0]\u003c/pre\u003e","function_template":"function zSorted = complexSort(z)\n  zSorted = z;\nend","test_suite":"%%\nj = sqrt(-1);\nz = [-4 6 3+4*j 1+j 0];\nzSorted_correct = [6 3+4*j -4 1+j 0];\nassert(isequal(complexSort(z),zSorted_correct))\n\n%%\nz = 1:10;\nzSorted_correct = 10:-1:1;\nassert(isequal(complexSort(z),zSorted_correct))","published":true,"deleted":false,"likes_count":29,"comments_count":5,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5799,"test_suite_updated_at":"2012-01-18T01:00:21.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:21.000Z","updated_at":"2026-03-29T20:41:11.000Z","published_at":"2012-01-18T01:00:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear first.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo if z is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ z = [-4 6 3+4i 1+i 0]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethen the output zSorted would be\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ zSorted = [6 3+4i -4 1+i 0]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44538,"title":"Arrange the names in alphabetical order (1)","description":"Arrange the list of names in alphabetical order. The original 'alphabetical order', that is: from α and β all the way through to ω. We might call this 'alpha-beta-cal order'!\r\nYou do not need to heed the capitalisation (uppercase versus lowercase) in determining the correct sequence, although it must be preserved in your final output.\r\nAccents or diacritics should not be heeded in determining the correct sequence, but should likewise be retained in the final output. This is consistent with some practice, albeit not universal. Only the 'tonos' will be present in the Test Suite (unless you try the optional Bonus Question).\r\nSorting should be based on the surname [family name], where present. The surname will always appear last, if present. In principle, if two surnames were alike, then one would have to next sort by the given name(s) [first name(s)] — however, that situation does not arise, and will not arise, in the Test Suite.\r\nInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\r\nEXAMPLE:\r\n % Input\r\n in = {'Δημήτρης Δραγατάκης'; 'Ρίτα Αμπατζή'}\r\n % Output\r\n out = {'Ρίτα Αμπατζή'; 'Δημήτρης Δραγατάκης'}\r\nAlthough Δ (delta, ~d) precedes Ρ (rho, ~r) in the Greek alphabet, we must sort first by surname, for which Α (alpha, ~a) precedes Δ (delta, ~d).\r\nSee also:\r\nProblem 44541","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 543.188px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 333px 271.587px; transform-origin: 333px 271.594px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eArrange the list of names in alphabetical order. The\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eoriginal\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 'alphabetical order', that is: from α and β all the way through to ω. We might call this\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e'alpha-beta-cal order'\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou do\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e need to heed the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ecapitalisation\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (uppercase versus lowercase) in determining the correct sequence, although it must be preserved in your final output.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 31.5px; text-align: left; transform-origin: 310px 31.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eAccents\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e or diacritics should\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e be heeded in determining the correct sequence, but should likewise be retained in the final output. This is consistent with\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/List_of_Greek_place_names\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003esome practice\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, albeit\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.tlg.uci.edu/help/Doc002.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003enot universal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Only the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003e'tonos'\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e will be present in the Test Suite (unless you try the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eoptional\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Bonus Question).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 42px; text-align: left; transform-origin: 310px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSorting should be based on the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003esurname\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e [family name], where present. The surname will always appear\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003elast\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, if present. In principle, if two surnames were alike, then one would have to next sort by the given name(s) [first name(s)] — however, that situation does\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003enot\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e arise, and will not arise, in the Test Suite.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 10.5px; text-align: left; transform-origin: 310px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEXAMPLE:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.75px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 330px 40.875px; transform-origin: 330px 40.875px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); \"\u003e% Input\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e in = {\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Δημήτρης Δραγατάκης'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e; \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Ρίτα Αμπατζή'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); text-decoration: none; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); \"\u003e% Output\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4375px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.8px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.8px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.8px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.8px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 330px 10.2125px; text-wrap-mode: nowrap; transform-origin: 330px 10.2188px; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; unicode-bidi: normal; white-space-collapse: preserve; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e out = {\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Ρίτα Αμπατζή'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e; \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); \"\u003e'Δημήτρης Δραγατάκης'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 310px 21px; text-align: left; transform-origin: 310px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eAlthough Δ (delta, ~d) precedes Ρ (rho, ~r) in the Greek alphabet, we must sort first by surname, for which Α (alpha, ~a) precedes Δ (delta, ~d).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 310px 10.5px; text-align: left; transform-origin: 310px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSee also:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 20.4375px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 317px 10.2125px; transform-origin: 317px 10.2188px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 289px 10.2125px; text-align: left; transform-origin: 289px 10.2188px; white-space-collapse: preserve; margin-left: 56px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44541\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 44541\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"% Comments ...\r\nfunction y = meSortEm( xVector )\r\n    z = x;\r\nend","test_suite":"%% Ensure generality\r\n% Don't hardcode solutions or use test-specific lookup tables.\r\n% (Lookup tables of letters are allowed, if you want, though.)\r\nRE = regexp(fileread('meSortEm.m'), '\\w+', 'match');\r\ntabooWords = {'Ἄρειος' 'Ἀριστοφάνης' 'Μαρία' 'Κάλλας' 'Φώτης' 'Καφάτος' ...\r\n        'Χρήστος' 'Δάντης' 'Διονύσιος' 'Δεμέτης' 'Γρηγόρης' 'Μπιθικώτσης' ...\r\n        'Αρετή' 'Κετιμέ' 'Παναγιώτης' 'Κόκορας' 'Ιάκωβος' 'Κολανιάν' ...\r\n        'Μαρινέλλα' 'Κώστας' 'Μουντάκης' 'Ζωρζ' 'Μουστακί'};\r\ntestResult = cellfun( @(z) ismember(z, lower(tabooWords)), lower(RE) );\r\nmsg = ['Please do not hard-code your ''solution''.' char([10 13]) 'Found: ' strjoin(RE(testResult)) '.' char([10 13])];\r\nassert(~any(  cellfun( @(z) ismember(z, lower(tabooWords)), lower(RE) )  ), msg)\r\n\r\n\r\n%% Ancient Greeks\r\n% BONUS QUESTION\r\n% More difficult due to the variety of diacritics present.\r\n% (For credit — or κῦδος — not for points.)\r\ndata = {'Αἰδεσία' 'Αἰνησίδημος' 'Αἰσάρα' 'Ἄρειος' 'Ἀριστοφάνης' ...\r\n        'Ἀριστοφῶν' 'Ἀριστώνυμος' 'Ἀσκληπιόδοτος'};\r\nL = length(data);\r\npassedTheBonusQuestion = true;\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    if ~isequal(meSortEm(input), list),\r\n        passedTheBonusQuestion = false;\r\n        disp('.')\r\n        disp('You have NOT solved the optional Bonus Question.')\r\n        disp('But you can still pass the Test Suite.')\r\n        return;\r\n    end;\r\n    %assert( isequal(meSortEm(input), list) )\r\nend;\r\ndisp('.')\r\ndisp('Congratulations:  you''ve solved the optional Bonus Question.')\r\n\r\n\r\n%% Various occupations\r\ndata = {'Γιάννα Αγγελοπούλου-Δασκαλάκη'\r\n'Οδυσσέας Αλεπουδέλλης'\r\n'Δημήτρης Βάρος'\r\n'Κική Δημουλά'\r\n'Οδυσσέας Ελύτης'\r\n'Αλέξανδρος Αρνόλδος Κωνσταντίνος Ισηγόνης'\r\n'Μαρία Κάλλας'\r\n'Κωνσταντίνος Καραθεοδωρή'\r\n'Φώτης Κ. Καφάτος'\r\n'Δημήτριος Κουκούζης'\r\n'Σπυρίδων Νικολάου Μαρινάτος'\r\n'Ντούλα Μουρίκη'\r\n'Ευστράτιος Ντελάρωφ'\r\n'Ἰωάννης Φωκᾶς'\r\n'Δημήτριος Χριστοδούλου'\r\n'Αριστοτέλης Ωνάσης'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Musicians:  A to ~G\r\ndata = {'Ρίτα Αμπατζή' 'Κώστας Ανδρέου' 'Θεόδωρος Αντωνίου' 'Γρηγόρης Ασίκης' ...\r\n        'Νικόλας Άσιμος' 'Χρήστος Δάντης' 'Διονύσιος Δεμέτης' 'Δημήτρης Δραγατάκης' ...\r\n        'Αντίοχος Ευαγγελάτος' 'Κωνσταντίνος Καραμητρούδης' 'Παύλος Καρρέρ' 'Μιλτιάδης Καρύδης' ...\r\n        'Γιώργος Μπάτης' 'Τζίνα Μπαχάουερ' 'Γρηγόρης Μπιθικώτσης' 'Μαρία Φαραντούρη' ...\r\n        'Γιάννης Χρήστου' 'Πέτρος Χριστοδουλίδης'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n%% Musicians:  ~G to K\r\ndata = {'Κατερίνα Γαρμπή'\r\n'Μιχάλης Γενίτσαρης'\r\n'Αλκίνοος Ιωαννίδης'\r\n'Λεωνίδας Καβάκος'\r\n'Στέλιος Καζαντζίδης'\r\n'Σωτήρης Κακίσης'\r\n'Μανώλης Καλομοίρης'\r\n'Ιάκωβος Καμπανέλλης'\r\n'Ελένη Καραΐνδρου'\r\n'Νίκος Καρβέλας'\r\n'Αντώνιος Κατινάρης'\r\n'Μπάμπης Κατσιώνης'\r\n'Άκης Κατσουπάκης'\r\n'Αρετή Κετιμέ'\r\n'Παναγιώτης Κόκορας'\r\n'Ιάκωβος Κολανιάν'\r\n'Σταύρος Κουγιουμτζής'\r\n'Μάνος Χατζιδάκις'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;\r\n\r\n\r\n%% Musicians:  L to ~M\r\ndata = {'Μάνος Λοΐζος' 'Σωκράτης Μάλαμας' 'Νικόλαος Χαλικιόπουλος Μάντζαρος' ...\r\n    'Μαρινέλλα' 'Γιάννης Μαρκόπουλος' 'Κώστας Μαρτάκης' ...\r\n    'Δημήτρης Μητροπάνος' 'Δημήτρης Μητρόπουλος' 'Αθανάσιος Μικρούτσικος' ...\r\n    'Κώστας Μουντάκης' 'Ζωρζ Μουστακί' 'Οριάνθη Παναγάρη' ...\r\n    'Γεώργιος Kυριάκος Παναγιώτου' 'Δημήτρης Πανούσης' 'Βασιλική Παπαδημητρίου' ...\r\n    'Λευτέρης Παπαδόπουλος' 'Λέανδρος Παπαθανασίου' 'Αθανάσιος Παπακωνσταντίνου' ...\r\n    'Έλενα Παπαρίζου'};\r\nL = length(data);\r\nfor i = 1 : 20\r\n    elsAll = randperm( L );\r\n    elsSome = elsAll(1 : 1+randi(L-1));\r\n    list = data( sort(elsSome) );\r\n    elsInput = randperm( length(list) );\r\n    input = list(elsInput);\r\n    assert( isequal(meSortEm(input), list) )\r\nend;","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":64439,"edited_by":64439,"edited_at":"2025-09-14T15:36:24.000Z","deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2025-09-14T15:36:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2018-03-09T04:20:18.000Z","updated_at":"2025-09-15T19:47:16.000Z","published_at":"2018-03-09T10:22:08.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eArrange the list of names in alphabetical order. The\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoriginal\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 'alphabetical order', that is: from α and β all the way through to ω. We might call this\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e'alpha-beta-cal order'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou do\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e need to heed the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecapitalisation\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (uppercase versus lowercase) in determining the correct sequence, although it must be preserved in your final output.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAccents\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e or diacritics should\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e be heeded in determining the correct sequence, but should likewise be retained in the final output. This is consistent with\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/List_of_Greek_place_names\\\"\u003e\u003cw:r\u003e\u003cw:t\u003esome practice\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, albeit\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.tlg.uci.edu/help/Doc002.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003enot universal\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Only the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e'tonos'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e will be present in the Test Suite (unless you try the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoptional\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Bonus Question).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSorting should be based on the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esurname\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [family name], where present. The surname will always appear\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003elast\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, if present. In principle, if two surnames were alike, then one would have to next sort by the given name(s) [first name(s)] — however, that situation does\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e arise, and will not arise, in the Test Suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEXAMPLE:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % Input\\n in = {'Δημήτρης Δραγατάκης'; 'Ρίτα Αμπατζή'}\\n % Output\\n out = {'Ρίτα Αμπατζή'; 'Δημήτρης Δραγατάκης'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAlthough Δ (delta, ~d) precedes Ρ (rho, ~r) in the Greek alphabet, we must sort first by surname, for which Α (alpha, ~a) precedes Δ (delta, ~d).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSee also:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44541\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44541\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45193,"title":"Fun with permutations","description":"There are factorial(N) permutations of the numbers from 1 to N. For each of these permutations, we can find the set of indexes j that will return the numbers to their original order, 1:N.  For example, if we generate a random permutation p with p = randperm(1:N) then the set of indices j that will return p to the original order\r\np(j) = 1:N may be found by [~,j] = sort(p).\r\n\r\nIt sometimes happens that this set of indices j and the corresponding permutation p are the same.  For example, if p = 1:N, then j = 1:N as well; and if p = N:-1:1, then\r\nj is also N:-1:1.  However, for N = 3, there are 6 permutations in all, and it happens that only 4 of them have this property.  \r\n\r\nYour task is to determine, given the value of N, the number of permutations p of the array 1:N for which the permutation p and the indexes j are the same.\r\n\r\ninput: N, the range of the integers,\r\noutput: The number of permutations of 1:N for which isequal(p,j)\r\n\r\nHINT: For N \u003c 12, you can probably solve this by checking each of the individual permutations, but for larger N this may prove to be too time-consuming.","description_html":"\u003cp\u003eThere are factorial(N) permutations of the numbers from 1 to N. For each of these permutations, we can find the set of indexes j that will return the numbers to their original order, 1:N.  For example, if we generate a random permutation p with p = randperm(1:N) then the set of indices j that will return p to the original order\r\np(j) = 1:N may be found by [~,j] = sort(p).\u003c/p\u003e\u003cp\u003eIt sometimes happens that this set of indices j and the corresponding permutation p are the same.  For example, if p = 1:N, then j = 1:N as well; and if p = N:-1:1, then\r\nj is also N:-1:1.  However, for N = 3, there are 6 permutations in all, and it happens that only 4 of them have this property.\u003c/p\u003e\u003cp\u003eYour task is to determine, given the value of N, the number of permutations p of the array 1:N for which the permutation p and the indexes j are the same.\u003c/p\u003e\u003cp\u003einput: N, the range of the integers,\r\noutput: The number of permutations of 1:N for which isequal(p,j)\u003c/p\u003e\u003cp\u003eHINT: For N \u0026lt; 12, you can probably solve this by checking each of the individual permutations, but for larger N this may prove to be too time-consuming.\u003c/p\u003e","function_template":"function y = funWithPerms(N)\r\n  y = N;\r\nend","test_suite":"%%\r\nN = 4;\r\ny_correct = 10;\r\nassert(funWithPerms(N) == y_correct);\r\n%%\r\nN = 6;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 38);\r\n%%\r\nN = 8;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 382);\r\n%%\r\nN = 10;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 2374);\r\n%%\r\nN = 12;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 35038);\r\n%%\r\nN = 14;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 298810);\r\n%%\r\nN = 16;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 5775842);\r\n%%\r\nN = 18;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 62332114);\r\n%%\r\nN = 20;\r\nassert(prod(unique(factor(funWithPerms(N)))) == 1484916506);\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":5,"created_by":8580,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-03T23:25:57.000Z","updated_at":"2025-11-06T15:52:17.000Z","published_at":"2019-11-03T23:41:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are factorial(N) permutations of the numbers from 1 to N. For each of these permutations, we can find the set of indexes j that will return the numbers to their original order, 1:N. For example, if we generate a random permutation p with p = randperm(1:N) then the set of indices j that will return p to the original order p(j) = 1:N may be found by [~,j] = sort(p).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIt sometimes happens that this set of indices j and the corresponding permutation p are the same. For example, if p = 1:N, then j = 1:N as well; and if p = N:-1:1, then j is also N:-1:1. However, for N = 3, there are 6 permutations in all, and it happens that only 4 of them have this property.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour task is to determine, given the value of N, the number of permutations p of the array 1:N for which the permutation p and the indexes j are the same.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003einput: N, the range of the integers, output: The number of permutations of 1:N for which isequal(p,j)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHINT: For N \u0026lt; 12, you can probably solve this by checking each of the individual permutations, but for larger N this may prove to be too time-consuming.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42811,"title":"Sorting integers by their digits (Level 2)","description":"This is the next step up from \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits Problem 42809\u003e.\r\n\r\nGiven a vector, v, of integers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nExample:\r\n\r\nv = [14 3 268 -14 210 1 80];\r\n\r\nw = [1 -14 14 210 268 3 80];\r\n\r\nAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\r\n\r\nNegative integers take precedence over positive integers.","description_html":"\u003cp\u003eThis is the next step up from \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits\"\u003eProblem 42809\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eGiven a vector, v, of integers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14 3 268 -14 210 1 80];\u003c/p\u003e\u003cp\u003ew = [1 -14 14 210 268 3 80];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/p\u003e\u003cp\u003eNegative integers take precedence over positive integers.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14 3 268 -14 210 1 80];\r\nw_correct = [1 -14 14 210 268 3 80];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-246 -24680 2468 246 24 -2 24680 -24 -2468 2];\r\nw_correct = [-2 2 -24 24 -246 246 -2468 2468 -24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-20T04:50:21.000Z","updated_at":"2026-03-12T02:54:13.000Z","published_at":"2016-04-20T04:50:21.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the next step up from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 42809\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of integers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14 3 268 -14 210 1 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [1 -14 14 210 268 3 80];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple integers starting with the same digits, such as 1 and 14, shorter integers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNegative integers take precedence over positive integers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42498,"title":"Pancake sorting - minimum flips.","description":"Sort a stack of pancakes by flipping them using spatula.\r\nThere are N pancakes with diameters 1:N.\r\nSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\r\nSort pancakes in increasing order.\r\nReturn a vector of places where spatula was inserted.\r\nMinimize number of flips, your score will depend on the number of flips in the last few tests.\r\nReferences: math.illinois.edu, wikipedia.\r\nExample (horizontal view):\r\nInitial stack:  6 4 2 5 3 1,         (\",\" indicates position of spatula)\r\nfirst flip:     1 3 5,2 4 6\r\nsecond:         5 3 1 2 4,6\r\n...             4 2 1 3,5 6\r\n                3 1 2,4 5 6\r\n                2 1,3 4 5 6\r\nsorted!         1 2 3 4 5 6\r\n\r\npositions of spatula from the begining: 6 3 5 4 3 2","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 388.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 194.25px; transform-origin: 407px 194.25px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 175.5px 8px; transform-origin: 175.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort a stack of pancakes by flipping them using spatula.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 122.6px; counter-reset: list-item 0; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 61.3px; transform-origin: 391px 61.3px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 31.5px 8px; transform-origin: 31.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThere are\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 5px 8px; transform-origin: 5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 79.5px 8px; transform-origin: 79.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e pancakes with diameters\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 11px 8px; transform-origin: 11px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003e1:N\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 273px 8px; transform-origin: 273px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 108px 8px; transform-origin: 108px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSort pancakes in increasing order.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 169px 8px; transform-origin: 169px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReturn a vector of places where spatula was inserted.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 322px 8px; transform-origin: 322px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eMinimize number of flips, your score will depend on the number of flips in the last few tests.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"background-position-x: 0px; background-position-y: 50%; block-size: 20.4333px; counter-reset: none; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10.2167px; text-align: left; transform-origin: 363px 10.2167px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 38.5px 8px; transform-origin: 38.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eReferences:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003emath.illinois.edu\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Pancake_sorting\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ewikipedia\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"background-position-x: 0%; background-position-y: 0%; block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 81.5px 8px; transform-origin: 81.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample (horizontal view):\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 183.9px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 91.95px; transform-origin: 404px 91.95px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 288px 8.5px; tab-size: 4; transform-origin: 288px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003eInitial \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003estack:\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 8px 8.5px; transform-origin: 8px 8.5px; \"\u003e  \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 44px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 44px 8.5px; \"\u003e6 4 2 5 3 1\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e,         (\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 16px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 16px 8.5px; \"\u003e\",\" \u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 120px 8.5px; transform-origin: 120px 8.5px; \"\u003eindicates position of spatula)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 24px 8.5px; transform-origin: 24px 8.5px; \"\u003efirst \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003eflip:\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e     \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e1 3 5\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 24px 8.5px; transform-origin: 24px 8.5px; \"\u003e,2 4 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003esecond:         5 3 1 2 4,6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"border-block-end-color: rgb(14, 0, 255); border-block-start-color: rgb(14, 0, 255); border-bottom-color: rgb(14, 0, 255); border-inline-end-color: rgb(14, 0, 255); border-inline-start-color: rgb(14, 0, 255); border-left-color: rgb(14, 0, 255); border-right-color: rgb(14, 0, 255); border-top-color: rgb(14, 0, 255); caret-color: rgb(14, 0, 255); color: rgb(14, 0, 255); column-rule-color: rgb(14, 0, 255); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(14, 0, 255); perspective-origin: 12px 8.5px; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); transform-origin: 12px 8.5px; \"\u003e...\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(2, 128, 9); border-block-start-color: rgb(2, 128, 9); border-bottom-color: rgb(2, 128, 9); border-inline-end-color: rgb(2, 128, 9); border-inline-start-color: rgb(2, 128, 9); border-left-color: rgb(2, 128, 9); border-right-color: rgb(2, 128, 9); border-top-color: rgb(2, 128, 9); caret-color: rgb(2, 128, 9); color: rgb(2, 128, 9); column-rule-color: rgb(2, 128, 9); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(2, 128, 9); perspective-origin: 96px 8.5px; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); transform-origin: 96px 8.5px; \"\u003e             4 2 1 3,5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e                3 1 2,4 5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e                2 1,3 4 5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 108px 8.5px; tab-size: 4; transform-origin: 108px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 24px 8.5px; transform-origin: 24px 8.5px; \"\u003esorted\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(178, 140, 0); border-block-start-color: rgb(178, 140, 0); border-bottom-color: rgb(178, 140, 0); border-inline-end-color: rgb(178, 140, 0); border-inline-start-color: rgb(178, 140, 0); border-left-color: rgb(178, 140, 0); border-right-color: rgb(178, 140, 0); border-top-color: rgb(178, 140, 0); caret-color: rgb(178, 140, 0); color: rgb(178, 140, 0); column-rule-color: rgb(178, 140, 0); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(178, 140, 0); perspective-origin: 84px 8.5px; text-decoration-color: rgb(178, 140, 0); text-emphasis-color: rgb(178, 140, 0); transform-origin: 84px 8.5px; \"\u003e!         1 2 3 4 5 6\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 204px 8.5px; tab-size: 4; transform-origin: 204px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 40px 8.5px; transform-origin: 40px 8.5px; \"\u003epositions \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 164px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 164px 8.5px; \"\u003eof spatula from the begining: 6 3 5 4 3 2\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sort_pancakes(stack)\r\n  y = 1:numel(stack);\r\nend","test_suite":"%% Coutresy of Alfonso Nieto-Castanon\r\n%urlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0\u0026amp;d=1','SetSolutionScore.p');\r\n%rehash path;\r\n\r\n%%\r\nx = 1:5;\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = [6 4 2 5 3 1];\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(12);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(13);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nfor k = 1:20\r\n  x = randperm(k);\r\n  for spatula = sort_pancakes(x)\r\n    x(1:spatula) = flip(x(1:spatula));\r\n  end\r\n  assert(issorted(x))\r\nend\r\n%% scoring set\r\n% this test may be extended and rescored\r\nsets = {\r\n  [10 3 2 1 6 5 4 8 7 9]\r\n  [10:-1:1]\r\n  [1:10]\r\n  [2:2:10 1:2:9]\r\n  [ 9 8 14 5 12 1 10 13 2 7 6 3 15 4 11]\r\n  [ 7 8 16 13 11 1 9 15 2 6 3 12 10 4 14 5]\r\n  [ 15 14 19 1 9 4 12 3 16 7 13 20 6 2 11 10 17 5 8 18]\r\n  [ 2 15 18 4 8 16 10 6 3 14 1 7 20 9 11 12 13 5 19 17 21]\r\n  [ 5 1 9 3 18 22 17 15 11 16 10 13 2 21 20 6 12 7 23 8 19 14 4]\r\n  [ 3 9 18 15 7 8 6 10 11 17 21 23 22 1 14 5 2 13 16 12 20 4 19]\r\n  [ 34 71 51 31 55 61 18 26 59 8 14 6 70 1 25 7 9 4 44 39 19 56 22 32 27 2 11 28 68 57 49 48 20 29 13 10 17 40 3 37 45 63 73 30 43 42 38 21 23 46 62 47 58 69 24 65 60 36 72 64 54 33 5 52 67 66 15 53 12 35 41 16 50]};\r\nfor k = 1:numel(sets)\r\n  x = sets{k};\r\n  queue = sort_pancakes(x);\r\n  for spatula = queue\r\n    x(1:spatula) = flip(x(1:spatula));\r\n  end\r\n  assert(issorted(x))\r\n  n(k) = numel(x);\r\n  score(k) = numel(queue);\r\nend\r\n%SetSolutionScore(sum(score));\r\n%fprintf('\\nTest %3d. %3d pancakes, %3d flips',[1:numel(sets); n; score]);","published":true,"deleted":false,"likes_count":4,"comments_count":5,"created_by":14358,"edited_by":223089,"edited_at":"2023-05-26T19:13:45.000Z","deleted_by":null,"deleted_at":null,"solvers_count":36,"test_suite_updated_at":"2023-05-26T19:13:45.000Z","rescore_all_solutions":false,"group_id":39,"created_at":"2015-08-06T15:12:33.000Z","updated_at":"2026-04-02T08:09:40.000Z","published_at":"2015-08-06T15:14:05.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a stack of pancakes by flipping them using spatula.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e pancakes with diameters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1:N\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort pancakes in increasing order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn a vector of places where spatula was inserted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMinimize number of flips, your score will depend on the number of flips in the last few tests.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReferences:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emath.illinois.edu\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pancake_sorting\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample (horizontal view):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Initial stack:  6 4 2 5 3 1,         (\\\",\\\" indicates position of spatula)\\nfirst flip:     1 3 5,2 4 6\\nsecond:         5 3 1 2 4,6\\n...             4 2 1 3,5 6\\n                3 1 2,4 5 6\\n                2 1,3 4 5 6\\nsorted!         1 2 3 4 5 6\\n\\npositions of spatula from the begining: 6 3 5 4 3 2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":94,"title":"Target sorting","description":"Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return the list sorted in descending order of the absolute value of the difference between |a(n)| and |t|.\n \nSo if a = [1 2 4 8 17] and t = 12, then the output b should be [1 2 4 17 8].\n","description_html":"\u003cp\u003eSort the given list of numbers \u003ctt\u003ea\u003c/tt\u003e according to how far away each element is from the target value \u003ctt\u003et\u003c/tt\u003e. The result should return the list sorted in descending order of the absolute value of the difference between \u003ctt\u003ea(n)\u003c/tt\u003e and \u003ctt\u003et\u003c/tt\u003e.\u003c/p\u003e\u003cp\u003eSo if a = [1 2 4 8 17] and t = 12, then the output b should be [1 2 4 17 8].\u003c/p\u003e","function_template":"function b = targetSort(a,t)\n  b = a;\nend","test_suite":"%%\na = [1 2 3 4];\nt = 0;\nb_correct = [4 3 2 1];\nassert(isequal(targetSort(a,t),b_correct))\n\n%%\na = -4:10;\nt = 3.6;\nb_correct = [-4 -3 10 -2 9 -1 8 0 7 1 6 2 5 3 4];\nassert(isequal(targetSort(a,t),b_correct))\n\n%%\na = 12;\nt = pi;\nb_correct = 12;\nassert(isequal(targetSort(a,t),b_correct))\n\n%%\na = -100:-95;\nt = 100;\nb_correct = [-100 -99 -98 -97 -96 -95];\nassert(isequal(targetSort(a,t),b_correct))\n\n\n","published":true,"deleted":false,"likes_count":31,"comments_count":6,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4564,"test_suite_updated_at":"2012-01-18T01:00:30.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:30.000Z","updated_at":"2026-03-22T15:40:36.000Z","published_at":"2012-01-18T01:00:30.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort the given list of numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e according to how far away each element is from the target value\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003et\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The result should return the list sorted in descending order of the absolute value of the difference between\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003et\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo if a = [1 2 4 8 17] and t = 12, then the output b should be [1 2 4 17 8].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46582,"title":"Find jumping medalists","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 288px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 144px; transform-origin: 407.5px 144px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 377.308px 7.875px; transform-origin: 377.308px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eKey questions in number theory involve the distribution of prime numbers. For example, the Twin Prime Conjecture states that infinitely many twin primes, or two primes separated by 2, exist. This conjecture has not been proved, and progress is addressed in an interesting \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.youtube.com/watch?v=vkMXdShDdtY\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003evideo from Numberphile\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.88333px 7.875px; transform-origin: 3.88333px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 374.983px 7.875px; transform-origin: 374.983px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem deals with the most common gap between primes up to a given number. John Conway dubbed this gap the \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://mathworld.wolfram.com/JumpingChampion.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"perspective-origin: 56.8083px 7.875px; transform-origin: 56.8083px 7.875px; \"\u003ejumping champion\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 324.392px 7.875px; transform-origin: 324.392px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. For numbers up to 20, the jumping champion is 2 because it occurs four times (between 3 and 5, 5 and 7, 11 and 13, and 17 and 19.) \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 293.708px 7.875px; transform-origin: 293.708px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTo me, the jumping champion is somewhat disappointing because 6 dominates until about 1.74\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAmCAYAAACMJGZuAAACdElEQVRoge2Z7ZGCMBCGnx7owAZsgAqowA6uAzqwBWuwBHuwBWugBe9HsucaIdnNHOLN5Z3J6MCSj4fN7gLQ1NTU1PQp2gFfwBh/c3Zj0s7Afu0JfooOwB24ALf4/0oAk+oYz+t2ec80t9eOAEiDORMgpB7WARPzEP+FvnjdQj0B1jE5PvIHvKiPzaoOGHjElME53kCAlUKULToRvM/b76rqCXdybkssaSQs5hSvHwjx54p9cZeZ8Xbx+JXneHUy9rmaZGJ6UhZYJ+YXILHmTh6YjDvxugVTOxnrTkgQm0hSuPxaYQ3Ktps5LxnvtnB+zyMmST9jYUyZ361g96PdwuAlWeoSCbQWWBJPlgJwp/rKeQ08gy1JtmWRwZ7gsheL8cxkjoXrrLC0V+W8QRZmgSDbrLSu0WhHzyMWWIEJKMsdtsLS8SMXk7RdybMlUVhgTQWbH4l3WYB5QIEdlo4zOQgj9m19xFZTnWMzywLMCwrssHTWtMKSjNnzms0ke2ovledGXb3Lut3PhTlgNaCgDlbuUURnV/EG8cprnOcQz6UAZW1T7OcQr/EUy0+aA1YLCvywSrFD9yewOh5eM7K8eFlLyc4lDUxXu15QUAcr51n6xrnizJra87w1akCBHdak7Lwxa3PpO+gpK1JtmQ3fotTVvXWYlhWWfiGXiyVWu7doLph76rBUNRW8xQMtxeaqymW9WmBbPRuuKkt5UAPMA0u8aykjHvgAr/LUUV5g1u0lyr3PEs/b7O1mTcFpBSZvOKV/a7UsQTx9U5o+vrxdsnBvDChdl36XS1vJI3esUG3/hmo/C/3bz0lNTU1NTU1NTU31+gYmIUCl6G4nbQAAAABJRU5ErkJggg==\" style=\"width: 37.5px; height: 19px;\" width=\"37.5\" height=\"19\"\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 68.45px 7.875px; transform-origin: 68.45px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Therefore, I will coin another term: the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 56.025px 7.875px; transform-origin: 56.025px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ejumping medalists\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 266.817px 7.875px; transform-origin: 266.817px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, or the three most common gaps between primes up to a given number. For numbers up to 20, the gold, silver, and bronze jumping medals (i.e., first, second, and third place) go to 2, 4, and 1, respectively.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 21px; text-align: left; transform-origin: 384.5px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 336.983px 7.875px; transform-origin: 336.983px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that determines the jumping medalists as well as the maximum gap. Award the medals as in \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/46576-award-medals-to-winners\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 46576\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 206.925px 7.875px; transform-origin: 206.925px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and return an empty vector for any medal that cannot be awarded.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 7.875px; transform-origin: 0px 7.875px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [J1,J2,J3,Jmax] = jumpingMedalists(n)\r\n  % J1, J2, J3 = most, second-most, and third-most common gaps, respectively\r\n  % Jmax = maximum gap \r\n  \r\n  J = f(n);\r\nend","test_suite":"%%\r\nn = 2;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nassert(isempty(J1) \u0026\u0026 isempty(J2) \u0026\u0026 isempty(J3) \u0026\u0026 isempty(Jmax))\r\n\r\n%%\r\nn = 5;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = [1 2];\r\nJmax_correct = 2;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isempty(J2) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 7;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = 1;\r\nJmax_correct = 2;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 11;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = [1 4];\r\nJmax_correct = 4;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 20;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = 4;\r\nJ3_correct = 1;\r\nJmax_correct = 4;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 100;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 2;\r\nJ2_correct = [4 6];\r\nJmax_correct = 8;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isempty(J3) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 3141;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 4;\r\nJ3_correct = 2;\r\nJmax_correct = 34;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 50011;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 2;\r\nJ3_correct = 4;\r\nJmax_correct = 72;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 6021023;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 2;\r\nJmax_correct = 154;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 12221997;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 2;\r\nJmax_correct = 154;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n%%\r\nn = 2e8;\r\n[J1,J2,J3,Jmax] = jumpingMedalists(n);\r\nJ1_correct = 6;\r\nJ2_correct = 12;\r\nJ3_correct = 4;\r\nJmax_correct = 248;\r\nassert(isequal(J1,J1_correct) \u0026\u0026 isequal(J2,J2_correct) \u0026\u0026 isequal(J3,J3_correct) \u0026\u0026 isequal(Jmax,Jmax_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":19,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-09-10T02:33:57.000Z","updated_at":"2026-01-20T11:05:32.000Z","published_at":"2020-09-10T04:15:57.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eKey questions in number theory involve the distribution of prime numbers. For example, the Twin Prime Conjecture states that infinitely many twin primes, or two primes separated by 2, exist. This conjecture has not been proved, and progress is addressed in an interesting \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.youtube.com/watch?v=vkMXdShDdtY\\\"\u003e\u003cw:r\u003e\u003cw:t\u003evideo from Numberphile\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem deals with the most common gap between primes up to a given number. John Conway dubbed this gap the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://mathworld.wolfram.com/JumpingChampion.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ejumping champion\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. For numbers up to 20, the jumping champion is 2 because it occurs four times (between 3 and 5, 5 and 7, 11 and 13, and 17 and 19.) \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTo me, the jumping champion is somewhat disappointing because 6 dominates until about 1.74\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e\\\\times 10^{35}\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Therefore, I will coin another term: the \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ejumping medalists\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, or the three most common gaps between primes up to a given number. For numbers up to 20, the gold, silver, and bronze jumping medals (i.e., first, second, and third place) go to 2, 4, and 1, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that determines the jumping medalists as well as the maximum gap. Award the medals as in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/46576-award-medals-to-winners\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 46576\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and return an empty vector for any medal that cannot be awarded.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":57988,"title":"Determine the minimum number of swaps to sort a vector","description":"Cody Problem 1401 asks us to sort a vector with the bubble sort algorithm and count the number of swaps needed. For example, to sort the vector [4 3 2 1] in increasing order, bubble sort requires six swaps. However, the vector can be sorted in only two swaps (4 \u0026 1 and 3 \u0026 2). \r\nWrite a function to determine the minimum number of swaps needed to sort a vector","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 93px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 46.5px; transform-origin: 407px 46.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/1401\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration-line: underline; \"\u003eCody Problem 1401\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 308.433px 8px; transform-origin: 308.433px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asks us to sort a vector with the bubble sort algorithm and count the number of swaps needed. For example, to sort the vector [4 3 2 1] in increasing order, bubble sort requires six swaps. However, the vector can be sorted in only two swaps (4 \u0026amp; 1 and 3 \u0026amp; 2). \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 260.083px 8px; transform-origin: 260.083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine the minimum number of swaps needed to sort a vector\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = countSwaps(x)\r\n  y = length(find(x~=sort(x)));\r\nend","test_suite":"%%\r\nx = 1;\r\nassert(isequal(countSwaps(x),0))\r\n\r\n%%\r\nx = [2 1];\r\nassert(isequal(countSwaps(x),1))\r\n\r\n%%\r\nx = [3 1 2];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = 1:4;\r\nassert(isequal(countSwaps(x),0))\r\n\r\n%%\r\nx = [4 2 3 1];\r\nassert(isequal(countSwaps(x),1))\r\n\r\n%%\r\nx = [1 4 2 3];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = [5 2 1 4 3];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = [5 2 4 1 3];\r\nassert(isequal(countSwaps(x),3))\r\n\r\n%%\r\nx = [5 1 4 2 3];\r\nassert(isequal(countSwaps(x),4))\r\n\r\n%%\r\nx = [2 4 3 5 1 6];\r\nassert(isequal(countSwaps(x),3))\r\n\r\n%%\r\nx = [2 5 3 4 1 6];\r\nassert(isequal(countSwaps(x),2))\r\n\r\n%%\r\nx = [10 8 7 6 2 3 1 5 4 9];\r\nassert(isequal(countSwaps(x),8))\r\n\r\n%%\r\nx = [8 1 10 6 3 2 4 5 7 9];\r\nassert(isequal(countSwaps(x),9))\r\n\r\n%%\r\nx = [12 14 13 18 9 2 7 5 16 10 8 4 11 6 3 1 17 15];\r\nassert(isequal(countSwaps(x),13))\r\n\r\n%%\r\nx = [87 79 11 21 140 69 109 126 24 162 10 142 91 7 174 90 157 124 42 147 84 4 96 34 143 95 2 116 101 56 88 134 160 177 85 65 180 35 81 139 179 128 20 137 141 93 151 156 135 28 98 163 45 33 13 37 61 59 19 43 17 166 82 14 123 54 60 120 127 149 80 168 146 30 171 169 119 108 136 75 117 78 18 15 164 175 104 89 118 155 165 145 133 125 58 112 150 5 132 130 38 105 57 97 121 110 26 29 3 115 36 6 70 178 12 74 50 122 39 153 158 83 167 27 66 40 172 138 176 86 152 8 92 129 51 114 159 76 16 113 44 48 99 131 63 62 71 144 72 68 25 67 53 49 170 173 1 100 103 52 9 64 47 94 55 46 111 161 77 31 32 107 73 154 106 41 22 148 23 102];\r\nassert(isequal(countSwaps(x),174))\r\n\r\n%%\r\nx = [169 154 170 136 92 138 108 172 144 94 33 21 23 22 8 146 53 93 145 153 95 31 25 104 90 27 58 71 13 64 65 5 74 137 30 117 125 143 85 51 68 89 157 48 176 11 115 79 91 178 52 39 98 120 107 131 82 18 158 174 142 173 45 50 38 7 105 165 84 97 101 10 81 67 111 109 46 160 139 155 47 114 40 126 110 66 179 20 41 69 86 166 49 4 128 167 124 87 57 56 17 24 132 43 3 149 103 123 100 135 60 121 34 80 2 63 156 118 147 159 28 72 55 16 168 96 127 73 175 164 141 140 76 36 133 19 152 6 113 129 163 9 1 44 29 134 150 177 130 99 12 35 37 112 119 14 32 70 161 180 106 15 42 148 102 88 171 162 116 75 122 54 61 62 78 83 59 151 26 77];\r\nassert(isequal(countSwaps(x),173))\r\n\r\n%%\r\nx = 1:10000;\r\nr = randperm(10000);\r\nn = randi(1000);\r\ni1 = r(1:2:2*n-1);\r\ni2 = r(2:2:2*n);\r\na = x(i1);\r\nx(i1) = x(i2);\r\nx(i2) = a;\r\nassert(isequal(countSwaps(x),n))\r\n\r\n%%\r\nfiletext = fileread('countSwaps.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') || contains(filetext, 'regexp'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2023-04-15T15:26:41.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-04-15T15:26:35.000Z","updated_at":"2023-04-15T15:26:41.000Z","published_at":"2023-04-15T15:26:41.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/1401\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 1401\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:rPr/\u003e\u003cw:t\u003e asks us to sort a vector with the bubble sort algorithm and count the number of swaps needed. For example, to sort the vector [4 3 2 1] in increasing order, bubble sort requires six swaps. However, the vector can be sorted in only two swaps (4 \u0026amp; 1 and 3 \u0026amp; 2). \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine the minimum number of swaps needed to sort a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1056,"title":"Partial sorting algorithm","description":"Return the top k elements of an input vector. A comparison function compareFcn(m,n) is provided to compare individual elements of the vector. The function returns true is element m should be ranked higher than element n. e.g.\r\n\r\n  partial_sort([4 3 2 1], 2, @(m,n) m \u003e n)\r\n  \r\n  ans =\r\n  \r\n       4     3\r\n\r\n  partial_sort([4 3 2 1], 2, @(m,n) m \u003c n)\r\n  \r\n  ans =\r\n  \r\n       1     2\r\n\r\nAll elements in the input vector will be unique.\r\n\r\nSolutions will be ranked on the total number of times comparison functions are called, over all the test cases.","description_html":"\u003cp\u003eReturn the top k elements of an input vector. A comparison function compareFcn(m,n) is provided to compare individual elements of the vector. The function returns true is element m should be ranked higher than element n. e.g.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003epartial_sort([4 3 2 1], 2, @(m,n) m \u003e n)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eans =\r\n\u003c/pre\u003e\u003cpre\u003e       4     3\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003epartial_sort([4 3 2 1], 2, @(m,n) m \u0026lt; n)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eans =\r\n\u003c/pre\u003e\u003cpre\u003e       1     2\u003c/pre\u003e\u003cp\u003eAll elements in the input vector will be unique.\u003c/p\u003e\u003cp\u003eSolutions will be ranked on the total number of times comparison functions are called, over all the test cases.\u003c/p\u003e","function_template":"function x = partial_sort(y,k,compareFcn)\r\n  ySorted = sort(y,'descend');\r\n  x = ySorted(1:k)\r\nend","test_suite":"%%\r\nfeval(@assignin,'caller','score',250);\r\n%% number of comparisons needed\r\nglobal totalNCompare\r\ntotalNCompare = 0;\r\n%% simple highest ranking\r\ncompareFcn = @(x,y) x(1) \u003e y(1);\r\ny = [6 3 1 9 5];\r\nx_correct = [9 6 5];\r\nprofile on\r\nx = partial_sort(y,3,compareFcn);\r\nassert(isequal(x,x_correct))\r\nprofile off\r\nstats = profile('info');\r\nfound = false;\r\nfor i = 1:length(stats.FunctionTable)\r\n    functionName = stats.FunctionTable(i).FunctionName;\r\n    numCalls = stats.FunctionTable(i).NumCalls;\r\n    if ~isempty(strfind(functionName,'@(x,y)x(1)\u003ey(1)'))\r\n        found = true;\r\n        break\r\n    end    \r\nend\r\nassert(found)\r\nglobal totalNCompare\r\ntotalNCompare = totalNCompare + numCalls;\r\n\r\n%% shortest strings\r\ncompareFcn = @(x,y) length(x) \u003c length(y);\r\ny = {'a','bc','def','ghij','klmno','pqrstu'};\r\nx_correct = {'a','bc','def','ghij'};\r\nprofile on\r\nx = partial_sort(y,4,compareFcn);\r\nassert(isequal(x,x_correct))\r\nprofile off\r\nstats = profile('info');\r\nfound = false;\r\nfor i = 1:length(stats.FunctionTable)\r\n    functionName = stats.FunctionTable(i).FunctionName;\r\n    numCalls = stats.FunctionTable(i).NumCalls;\r\n    if ~isempty(strfind(functionName,'@(x,y)length(x)\u003clength(y)'))\r\n        found = true;\r\n        break\r\n    end    \r\nend\r\nassert(found)\r\nglobal totalNCompare\r\ntotalNCompare = totalNCompare + numCalls;\r\n\r\n%% order by division\r\ncompareFcn = @(x,y) mod(x(1),y(1)) == 0;\r\ny = [1 2 3 4 5 6 10 12 15 20 30 60];\r\nx_correct = [60 30 12 20];\r\nprofile on\r\nx = partial_sort(y,4,compareFcn);\r\nassert(isequal(sort(x),sort(x_correct)))\r\nprofile off\r\nstats = profile('info');\r\nfound = false;\r\nfor i = 1:length(stats.FunctionTable)\r\n    functionName = stats.FunctionTable(i).FunctionName;\r\n    numCalls = stats.FunctionTable(i).NumCalls;\r\n    if ~isempty(strfind(functionName,'@(x,y)mod(x(1),y(1))==0'))\r\n        found = true;\r\n        break\r\n    end    \r\nend\r\nassert(found)\r\nglobal totalNCompare\r\ntotalNCompare = totalNCompare + numCalls;\r\n\r\n%%\r\nglobal totalNCompare\r\nfeval(@assignin,'caller','score',totalNCompare);\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":450,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":"2012-11-25T18:26:40.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-11-24T22:40:03.000Z","updated_at":"2012-11-25T18:26:40.000Z","published_at":"2012-11-24T22:55:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn the top k elements of an input vector. A comparison function compareFcn(m,n) is provided to compare individual elements of the vector. The function returns true is element m should be ranked higher than element n. e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[partial_sort([4 3 2 1], 2, @(m,n) m \u003e n)\\n\\nans =\\n\\n       4     3\\n\\npartial_sort([4 3 2 1], 2, @(m,n) m \u003c n)\\n\\nans =\\n\\n       1     2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAll elements in the input vector will be unique.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolutions will be ranked on the total number of times comparison functions are called, over all the test cases.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1876,"title":"GJam: 2013 China Event: Name Sorting","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2933486/dashboard#s=p2 GJam 2013 China Moist\u003e. The problem is Codified by making the input a cell array of names.\r\n\r\nThe Challenge involves a serial card sorting machine that places card (i+1) in its best position, 1 thru i, if the name on card (i+1) is lexicographically greater than the name on card (i). The machine continues thru the end of the deck. The machine then restarts at card 1 until the order is correct. The output to return is the number of card insertions. The character values follow ascii codes with Space \u003c A:Z \u003c a:z. A shorter name is less than an extended name (Ab\u003cAbe)\r\n\r\n*Input:* names  ( cell array of names )\r\n\r\n*Output:* Insertions  (count of card insertions required)\r\n\r\n*Competition Summary:*  Best Time 6 minutes, 793/1049 correct\r\n\r\n*Example:*\r\n\r\nnames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\r\n\r\nClearly takes 3 card insertions. Start (SRJD)  moves [(RSJD) (JRSD) (DJRS)]","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2933486/dashboard#s=p2\"\u003eGJam 2013 China Moist\u003c/a\u003e. The problem is Codified by making the input a cell array of names.\u003c/p\u003e\u003cp\u003eThe Challenge involves a serial card sorting machine that places card (i+1) in its best position, 1 thru i, if the name on card (i+1) is lexicographically greater than the name on card (i). The machine continues thru the end of the deck. The machine then restarts at card 1 until the order is correct. The output to return is the number of card insertions. The character values follow ascii codes with Space \u0026lt; A:Z \u0026lt; a:z. A shorter name is less than an extended name (Ab\u0026lt;Abe)\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e names  ( cell array of names )\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Insertions  (count of card insertions required)\u003c/p\u003e\u003cp\u003e\u003cb\u003eCompetition Summary:\u003c/b\u003e  Best Time 6 minutes, 793/1049 correct\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003enames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\u003c/p\u003e\u003cp\u003eClearly takes 3 card insertions. Start (SRJD)  moves [(RSJD) (JRSD) (DJRS)]\u003c/p\u003e","function_template":"function cost=sort_cost(names)\r\n% names is a cell array\r\n  cost=0;\r\nend","test_suite":"%%\r\ntic\r\nnames={'Daniil Barantsev' 'Maria Balaba' 'Krisztina Barta' 'Patrice Archetto' 'Petra Arponen' 'Giovanna Almeida Leto' 'Tanith Belbin' 'Melania Albea' 'Lubov Bakirova' 'Mao Asada' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Fedor Andreev' 'Alessia Aureli' };\r\nexp=1;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jeremy Allen' 'Vazgen Azrojan' 'Zabato Bebe' 'An Ni' 'Vladimir Belomoin' 'Julia Beloglazova' 'Irina Babenko' 'Vitali Baranov' 'Vadim Akolzin' 'Mai Asada' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Babkin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mary Grace Baldo' 'Dmitri Antoni' 'Andrew Bassi' 'Tanith Belbin' 'Emilia Ahsan' 'Adrian Alvarado' 'Michael Bahoric' 'Vitali Babkin' 'Charlotte Belair' 'Annie Bellemare' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Baranov' 'William Beier' 'Charlotte Belair' 'Andrei Bekh' 'Letizia Alessandrini' 'Oksana Baiul' 'Felicia Beck' 'Margaret Albia' 'Johanna Allik' 'Christiane Berger' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vadim Akolzin' 'Dmitri Antoni' 'Petra Arponen' 'Felicia Beck' 'Letizia Alessandrini' 'Marina Anissina' 'Alisa Allapach' 'An Yang' 'Tobias Bayer' 'Imola Antal' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Stuart Beckingham' 'Ryan Arnold' 'Vazgen Azrojan' 'Oksana Baiul' 'Laurent Alvarez' 'Vitali Baranov' 'Tayfun Anar' 'Andrei Bekh' 'Evan Bates' 'Ilia Averbukh' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alibel Alegre' 'Alla Beknazarova' 'Andrew Bassi' 'Megan Allely' 'Elladj Balde' 'Tatiana Basova' 'Olga Akimova' 'Marta Andrade' 'Mao Asada' 'Becky Bereswill' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Laurent Alvarez' 'Mary Grace Baldo' 'Julia Abolina' 'Krisztina Barta' 'Marina Aganina' 'Becky Bereswill' 'Olga Akimova' 'Vazgen Azrojan' 'Elena Berezhnaya' 'Yann Abback' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mao Asada' 'Vitali Baranov' 'Rinata Araslanova' 'Margaret Albia' 'Giovanna Almeida Leto' 'Hanna Asadchaya' 'Andrew Bassi' 'Marina Anissina' 'Tayfun Anar' 'Birce Atabey' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\r\nexp=3;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Marina Anissina' 'Valentina Anselmi' 'Spencer Barnes' 'Ivan Bariev' 'Miki Ando' 'Alexandra Baurina' 'Maria Balaba' 'Andrew Bassi' 'Imola Antal' 'Anastasia Belova' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Felicia Beck' 'William Beier' 'John Baldwin' 'Julia Beloglazova' 'Margaret Albia' 'Colette Appel' 'Maria Balaba' 'Olga Akimova' 'Daniil Barantsev' 'Sara Beikircher' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Petra Arponen' 'Christina Beier' 'Alexei Beletski' 'Tayfun Anar' 'Saulius Ambrulevicius' 'Patrice Archetto' 'Rinata Araslanova' 'Sofia Bardakov' 'Alisa Allapach' 'Nadine Ahmed' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'Kevin Alves' 'Adrian Alvarado' 'Florent Amodio' 'Andrei Bekh' 'Alisa Agafonova' 'Gabor Balint' 'Giovanna Almeida Leto' 'Letizia Alessandrini' 'Oksana Baiul' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alisa Agafonova' 'Kevin Alves' 'Laurent Alvarez' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Miki Ando' 'Gloria Agogliati' 'An Yang' 'Felicia Beck' 'Tobias Bayer' 'Vitali Babkin' 'Andrei Bekh' 'Ivan Bariev' 'Melania Albea' 'Florent Amodio' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alla Beknazarova' 'Erica Archambault' 'Fedor Andreev' 'Felicia Beck' 'Irina Babenko' 'Krisztian Andraska' 'Mai Asada' 'Marina Aganina' 'Melania Albea' 'Vadim Akolzin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Michael Bahoric' 'Evan Bates' 'Olga Akimova' 'Emilia Ahsan' 'Vitali Baranov' 'Erica Archambault' 'Charlotte Belair' 'Alexandra Baurina' 'Tayfun Anar' 'Vera Bazarova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Vera Bazarova' 'Spencer Barnes' 'Annie Bellemare' 'Krisztina Barta' 'Olga Akimova' 'Vadim Akolzin' 'Veronika Benesova' 'Adrian Alvarado' 'Alexander Abt' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Gloria Agogliati' 'Elladj Balde' 'Colette Appel' 'An Yang' };\r\nexp=4;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Hanna Asadchaya' 'Ian Beharry' 'Julia Beloglazova' 'Michael Bahoric' 'Shizuka Arakawa' 'Spencer Barnes' 'Vera Bazarova' 'Vladimir Belomoin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Emilia Ahsan' 'Alisa Allapach' 'Felicia Beck' 'Engin Ali Artan' 'Valentina Anselmi' 'Alexander Abt' 'Jill Bakker' 'Jody Annandale' 'Nina Bates' 'Irina Babenko' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Evan Bates' 'Sergei Baranov' 'Rie Arikawa' 'Florent Amodio' 'Nadine Ahmed' 'Alla Beknazarova' 'Sofia Bardakov' 'Alexander Abt' 'Birce Atabey' 'Charlotte Belair' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexander Abt' 'Charlotte Belair' 'Kristen Avis' 'Nadine Ahmed' 'Tanith Belbin' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Bogdan Berezenko' 'Veronika Benesova' 'Sarah Abitbol' 'Christiane Berger' 'Tayfun Anar' 'Giovanna Almeida Leto' 'Michael Bahoric' 'John Baldwin' 'Elladj Balde' 'Jill Bakker' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Elvis Stojko' 'Evgeni Plushenko' 'KristiYamaguchi' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztian Andraska' 'Katarina Babalova' 'Annie Bellemare' 'Melania Albea' 'Petra Arponen' 'Irina Babenko' 'Johanna Allik' 'Sara Beikircher' 'Charlotte Belair' 'Miki Ando' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Oksana Baiul' 'MichelleKwan' };\r\nexp=1;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexei Beletski' 'Joelle Bastiaans' 'Alisa Allapach' 'Alisa Agafonova' 'Vladimir Belomoin' 'Letizia Alessandrini' 'Krisztina Barta' 'Becky Bereswill' 'Benjamin Agosto' 'Michael Bahoric' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Margaret Albia' 'Johanna Allik' 'Daniil Barantsev' 'Camilla Andersen' 'Andrei Bekh' 'Alla Beknazarova' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alisa Allapach' 'Andrew Bassi' 'Daniil Barantsev' 'Hanna Asadchaya' 'Imola Antal' 'Jeremy Abbott' 'Jill Bakker' 'Marina Anissina' 'Rinata Araslanova' 'Shizuka Arakawa' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Tayfun Anar' 'Rinata Araslanova' 'Nina Bates' 'Michael Bahoric' 'Julia Abolina' 'Jeremy Abbott' 'Ian Beharry' 'Engin Ali Artan' 'Colette Appel' 'Birce Atabey' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Melania Albea' 'Nadine Ahmed' 'Miki Ando' 'Alexei Beletski' 'Florent Amodio' 'Jake Bennett' 'Camilla Andersen' 'Jeremy Allen' 'Rie Arikawa' 'Kristen Avis' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Laurent Alvarez' 'Katarina Babalova' 'Shizuka Arakawa' 'Elladj Balde' 'Daniil Barantsev' 'Gabor Balint' 'Adrian Alvarado' 'Andrew Bassi' 'Anastasia Belova' 'Krisztina Barta' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexandra Baurina' 'Jake Bennett' 'Marina Aganina' 'Marina Anissina' 'Vadim Akolzin' 'William Beier' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Adrian Alvarado' 'Alisa Agafonova' 'Charlotte Belair' 'Evan Bates' 'Gloria Agogliati' 'Pascale Bergeron' 'Sarah Abitbol' 'Stuart Beckingham' 'Tayfun Anar' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Miguel Ballesteros' 'Julia Beloglazova' 'Eve Bentley' 'Spencer Barnes' 'Jeremy Allen' 'Megan Allely' 'Katarina Babalova' 'Birce Atabey' 'Jeremy Abbott' 'Vladimir Belomoin' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Engin Ali Artan' 'Christiane Berger' 'Petra Arponen' 'Veronika Benesova' 'Vera Bazarova' 'Andrew Bassi' 'Anastasia Belova' 'Kristen Avis' 'Margaret Albia' 'Alexei Beletski' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexandra Baurina' 'Gabor Balint' 'Emili Arm' 'Elena Berezhnaya' 'Tanith Belbin' 'Dmitri Antoni' 'Adrian Alvarado' 'Melania Albea' 'Andrew Bassi' 'Engin Ali Artan' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Gabor Balint' 'Imola Antal' 'Mao Asada' 'Jeremy Allen' 'Hanna Asadchaya' 'Charlotte Belair' 'Evan Bates' 'Alexei Beletski' 'William Beier' 'Michael Bahoric' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Giovanna Almeida Leto' 'Gabor Balint' 'Krisztian Andraska' 'Benjamin Agosto' 'Evan Bates' 'Maria Balaba' 'Marta Andrade' 'Ian Beharry' 'Tatiana Basova' 'Rie Arikawa' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexandra Baurina' 'Imola Antal' 'Evan Bates' 'Felicia Beck' 'Ian Beharry' 'Bogdan Berezenko' 'Becky Bereswill' 'Michael Bahoric' 'Tayfun Anar' 'Stuart Beckingham' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Charlotte Belair' 'An Yang' 'Paolo Bacchini' 'Olga Akimova' 'Vitali Baranov' 'Spencer Barnes' 'Valentina Anselmi' 'Annie Bellemare' 'Mary Grace Baldo' 'Ivan Bariev' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Katarina Babalova' 'Bogdan Berezenko' 'Marta Andrade' 'Vadim Akolzin' 'Spencer Barnes' 'Michael Bahoric' 'Krisztian Andraska' 'Alibel Alegre' 'Emilia Ahsan' 'Beril Bektas' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Birce Atabey' 'Anastasia Belova' 'Tobias Bayer' 'Kristen Avis' 'Rima Beliy' 'Andrew Bassi' 'Letizia Alessandrini' 'Alexei Beletski' 'Julia Abolina' 'Evan Bates' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztian Andraska' 'Sarah Abitbol' 'Kristen Avis' 'Tayfun Anar' 'Vadim Akolzin' 'Letizia Alessandrini' 'Margaret Albia' 'Joelle Bastiaans' 'Pascale Bergeron' 'Elladj Balde' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Hanna Asadchaya' 'Johanna Allik' 'Nadine Ahmed' 'Sarah Abitbol' 'Elladj Balde' 'Jake Bennett' 'Saulius Ambrulevicius' 'Laurent Alvarez' 'Beril Bektas' 'Krisztina Barta' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Spencer Barnes' 'Shizuka Arakawa' 'Sara Beikircher' 'Ryan Arnold' 'Pascale Bergeron' 'Hanna Asadchaya' 'Bogdan Berezenko' 'Annie Bellemare' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Patrice Archetto' 'Vera Bazarova' 'Miki Ando' 'Beril Bektas' 'Rie Arikawa' 'Adrian Alvarado' 'Rima Beliy' 'Fedor Andreev' 'Megan Allely' 'Nina Bates' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexei Beletski' 'Letizia Alessandrini' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Sofia Bardakov' 'Julia Abolina' 'Tayfun Anar' 'Miguel Ballesteros' 'Daniil Barantsev' 'Elladj Balde' 'John Baldwin' 'Alisa Agafonova' 'Benjamin Agosto' 'Vera Bazarova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Paolo Bacchini' 'Patrice Archetto' 'Anastasia Belova' 'Emili Arm' 'Ian Beharry' 'Evan Bates' 'Kevin Alves' 'Gabor Balint' 'Johanna Allik' 'Spencer Barnes' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Sergei Baranov' 'Mai Asada' 'Gabor Balint' 'Vazgen Azrojan' 'Christiane Berger' 'Alisa Allapach' 'Paolo Bacchini' 'An Yang' 'Lubov Bakirova' 'Stuart Beckingham' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Laurent Alvarez' 'Dmitri Antoni' 'Annie Bellemare' 'Veronika Benesova' 'Ivan Bariev' 'Emili Arm' 'An Yang' 'Colette Appel' 'Vitali Baranov' 'Fedor Andreev' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Birce Atabey' 'Camilla Andersen' 'Charlotte Belair' 'Daniil Barantsev' 'Krisztian Andraska' 'Mai Asada' 'Marina Aganina' 'Mary Grace Baldo' 'Shizuka Arakawa' 'Joelle Bastiaans' };\r\nexp=1;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Babkin' 'Colette Appel' 'Saulius Ambrulevicius' 'Fedor Andreev' 'Sofia Bardakov' 'Daniil Barantsev' 'Kevin Alves' 'Birce Atabey' 'Becky Bereswill' 'Letizia Alessandrini' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Ilia Averbukh' 'Jake Bennett' 'Julia Beloglazova' 'Petra Arponen' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Pascale Bergeron' 'Engin Ali Artan' 'Zabato Bebe' 'Shizuka Arakawa' 'Vazgen Azrojan' 'Elena Berezhnaya' 'Alisa Agafonova' 'Alisa Allapach' 'Laurent Alvarez' 'Marta Andrade' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztina Barta' 'Marta Andrade' 'Andrei Bekh' 'Stuart Beckingham' 'Pascale Bergeron' 'Sara Beikircher' 'Ivan Bariev' 'Gabor Balint' 'Dmitri Antoni' 'Mao Asada' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Tanith Belbin' 'Marta Andrade' 'Zabato Bebe' 'Emilia Ahsan' 'Johanna Allik' 'Christina Beier' 'Alexander Abt' 'Shizuka Arakawa' 'Eve Bentley' 'Sara Beikircher' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Julia Abolina' 'Felicia Beck' 'Vadim Akolzin' 'Letizia Alessandrini' 'Gloria Agogliati' 'Olga Akimova' 'Christina Beier' 'Tayfun Anar' 'Adrian Alvarado' 'Elena Berezhnaya' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alessia Aureli' 'Mao Asada' 'Mai Asada' 'Nadine Ahmed' 'Jeremy Abbott' 'Gabor Balint' 'Marina Anissina' 'Birce Atabey' 'Miguel Ballesteros' 'Beril Bektas' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Birce Atabey' 'Emilia Ahsan' 'Felicia Beck' 'Jeremy Allen' 'Oksana Baiul' 'Alisa Agafonova' 'Florent Amodio' 'Joelle Bastiaans' 'Michael Bahoric' 'Saulius Ambrulevicius' };\r\nexp=4;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Benjamin Agosto' 'Vitali Babkin' 'Vitali Baranov' 'Bogdan Berezenko' 'Mai Asada' 'Beril Bektas' 'Hanna Asadchaya' 'Camilla Andersen' 'An Yang' 'Rie Arikawa' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Tobias Bayer' 'Joelle Bastiaans' 'Alibel Alegre' 'Annie Bellemare' 'Alessia Aureli' 'Emili Arm' 'Florent Amodio' 'Julia Beloglazova' 'Birce Atabey' 'Sofia Bardakov' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Giovanna Almeida Leto' 'Alexandra Baurina' 'Marta Andrade' 'Julia Beloglazova' 'Felicia Beck' 'Johanna Allik' 'Rima Beliy' 'Gloria Agogliati' 'Rie Arikawa' 'Eve Bentley' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Katarina Babalova' 'Elena Berezhnaya' };\r\nexp=2;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Adrian Alvarado' 'Rinata Araslanova' 'Vitali Baranov' 'Yann Abback' 'Emili Arm' 'Marina Anissina' 'Engin Ali Artan' 'Jeremy Abbott' 'Alessia Aureli' };\r\nexp=9;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'John Baldwin' 'Laurent Alvarez' 'Erica Archambault' 'Emilia Ahsan' 'Johanna Allik' 'Hanna Asadchaya' 'Alexandra Baurina' 'Vitali Babkin' 'Rinata Araslanova' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Fedor Andreev' 'Shizuka Arakawa' 'Oksana Baiul' 'Kevin Alves' 'Jody Annandale' 'Christiane Berger' 'Sofia Bardakov' 'Emilia Ahsan' 'Ryan Arnold' 'Tayfun Anar' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Sergei Baranov' 'Saulius Ambrulevicius' 'Michael Bahoric' 'Evan Bates' 'An Ni' 'Tobias Bayer' 'Christina Beier' 'Maria Balaba' 'Emili Arm' 'Jody Annandale' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alexei Beletski' 'Florent Amodio' 'Marina Anissina' 'Margaret Albia' 'Michael Bahoric' 'Miki Ando' 'Gloria Agogliati' 'Evan Bates' 'Becky Bereswill' 'Alexandra Baurina' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'Emilia Ahsan' 'Ian Beharry' 'Paolo Bacchini' 'Maria Balaba' 'Giovanna Almeida Leto' 'An Yang' 'Michael Bahoric' 'Fedor Andreev' 'Alisa Agafonova' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Jill Bakker' 'Vazgen Azrojan' 'Sara Beikircher' 'Eve Bentley' 'Alla Beknazarova' 'Pascale Bergeron' 'Tatiana Basova' 'Elena Berezhnaya' 'Oksana Baiul' 'Zabato Bebe' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alessia Aureli' 'Alexei Beletski' 'Alisa Agafonova' 'Anastasia Belova' 'Colette Appel' 'Kevin Alves' 'Veronika Benesova' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Zabato Bebe' 'Tayfun Anar' 'Saulius Ambrulevicius' 'Miguel Ballesteros' 'Maria Balaba' 'Mai Asada' 'Lubov Bakirova' 'Edward Alton' 'Birce Atabey' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Miki Ando' 'Benjamin Agosto' 'Jeremy Allen' 'Adrian Alvarado' 'Alisa Allapach' 'Sofia Bardakov' 'Joelle Bastiaans' 'Margaret Albia' 'Erica Archambault' 'Kevin Alves' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Julia Beloglazova' 'Marina Aganina' 'Alisa Agafonova' 'Alexei Beletski' 'Camilla Andersen' 'Giovanna Almeida Leto' 'Colette Appel' 'Nina Bates' 'Tanith Belbin' 'Vitali Baranov' };\r\nexp=5;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mao Asada' 'Dmitri Antoni' 'Marina Aganina' 'Annie Bellemare' 'Zabato Bebe' 'Andrew Bassi' 'Valentina Anselmi' 'Michael Bahoric' 'Jake Bennett' 'Mary Grace Baldo' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Shizuka Arakawa' 'Stuart Beckingham' 'Jeremy Abbott' 'Nadine Ahmed' 'Olga Akimova' 'Vadim Akolzin' 'Becky Bereswill' 'Charlotte Belair' 'Gabor Balint' 'Margaret Albia' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Beril Bektas' 'Stuart Beckingham' 'Jill Bakker' 'Daniil Barantsev' 'Sarah Abitbol' 'Benjamin Agosto' 'Andrei Bekh' 'Julia Beloglazova' 'Alibel Alegre' 'Nina Bates' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Charlotte Belair' 'Gloria Agogliati' 'Miguel Ballesteros' 'Hanna Asadchaya' 'Ilia Averbukh' 'Katarina Babalova' 'Tobias Bayer' 'Marta Andrade' 'Petra Arponen' 'Paolo Bacchini' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Evan Bates' 'Imola Antal' 'Eve Bentley' 'Miguel Ballesteros' 'Emili Arm' 'Rie Arikawa' 'Patrice Archetto' 'Julia Abolina' 'Jeremy Allen' 'Edward Alton' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mary Grace Baldo' 'William Beier' 'Mai Asada' 'Vazgen Azrojan' 'Marina Anissina' 'Krisztian Andraska' 'Ivan Bariev' 'Tayfun Anar' 'Spencer Barnes' 'Maria Balaba' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Lubov Bakirova' 'Alexei Beletski' 'Mai Asada' 'William Beier' 'Shizuka Arakawa' 'Alla Beknazarova' 'Alessia Aureli' 'Miguel Ballesteros' 'Rinata Araslanova' 'Alexander Abt' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vitali Baranov' 'Patrice Archetto' 'Charlotte Belair' 'Maria Balaba' 'Marina Anissina' 'Oksana Baiul' 'Alla Beknazarova' 'Shizuka Arakawa' 'Andrei Bekh' 'Zabato Bebe' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Krisztina Barta' 'Yann Abback' 'Johanna Allik' 'Andrew Bassi' 'Irina Babenko' 'Fedor Andreev' 'Emilia Ahsan' 'Mary Grace Baldo' 'Tanith Belbin' 'Spencer Barnes' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Shizuka Arakawa' 'Tanith Belbin' 'Hanna Asadchaya' 'Mai Asada' 'Krisztian Andraska' 'Gabor Balint' 'Sofia Bardakov' 'Gloria Agogliati' 'Valentina Anselmi' 'Alisa Agafonova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Ilia Averbukh' 'Andrei Bekh' 'Imola Antal' 'Mao Asada' 'Colette Appel' 'Emili Arm' 'Irina Babenko' 'Sergei Baranov' 'Elena Berezhnaya' 'Julia Beloglazova' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Ryan Arnold' 'Rie Arikawa' 'Nina Bates' 'Katarina Babalova' 'Jeremy Allen' 'Charlotte Belair' 'Alexei Beletski' };\r\nexp=6;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Vladimir Belomoin' 'Melania Albea' 'Florent Amodio' 'An Ni' 'John Baldwin' 'Jeremy Abbott' 'Zabato Bebe' 'Olga Akimova' 'Petra Arponen' 'Jake Bennett' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Alisa Agafonova' };\r\nexp=0;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Elladj Balde' 'Charlotte Belair' 'Bogdan Berezenko' 'Julia Abolina' 'Alexandra Baurina' 'Sergei Baranov' 'Megan Allely' 'Marta Andrade' 'Anastasia Belova' 'Ivan Bariev' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Gloria Agogliati' 'Alessia Aureli' 'Julia Abolina' 'Charlotte Belair' 'Andrew Bassi' 'Gabor Balint' 'Vladimir Belomoin' 'Tanith Belbin' 'Patrice Archetto' 'Shizuka Arakawa' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Mary Grace Baldo' 'Florent Amodio' 'Vitali Babkin' 'Engin Ali Artan' 'Olga Akimova' 'Maria Balaba' 'Jeremy Allen' 'Margaret Albia' 'Ivan Bariev' 'Miguel Ballesteros' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Andrew Bassi' 'Tobias Bayer' 'Hanna Asadchaya' 'Krisztian Andraska' 'Vladimir Belomoin' 'Erica Archambault' 'Ilia Averbukh' 'Ivan Bariev' 'Margaret Albia' 'Michael Bahoric' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Hanna Asadchaya' 'Gloria Agogliati' 'Camilla Andersen' 'Veronika Benesova' 'Alisa Allapach' 'Charlotte Belair' 'Emili Arm' 'Jake Bennett' 'An Yang' 'Krisztina Barta' };\r\nexp=8;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\n%%\r\nnames={'Patrice Archetto' 'Christina Beier' 'Ivan Bariev' 'Rima Beliy' 'Alisa Allapach' 'Paolo Bacchini' 'William Beier' 'An Ni' 'Spencer Barnes' 'Vera Bazarova' };\r\nexp=7;\r\ncost=sort_cost(names);\r\nassert(cost==exp)\r\ntoc\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-16T04:35:47.000Z","updated_at":"2025-11-21T08:36:28.000Z","published_at":"2013-09-16T04:51:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2933486/dashboard#s=p2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 China Moist\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. The problem is Codified by making the input a cell array of names.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Challenge involves a serial card sorting machine that places card (i+1) in its best position, 1 thru i, if the name on card (i+1) is lexicographically greater than the name on card (i). The machine continues thru the end of the deck. The machine then restarts at card 1 until the order is correct. The output to return is the number of card insertions. The character values follow ascii codes with Space \u0026lt; A:Z \u0026lt; a:z. A shorter name is less than an extended name (Ab\u0026lt;Abe)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e names ( cell array of names )\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Insertions (count of card insertions required)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCompetition Summary:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Best Time 6 minutes, 793/1049 correct\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003enames={'Stuart Beckingham' 'Rinata Araslanova' 'Jeremy Abbott' 'Daniil Barantsev' };\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eClearly takes 3 card insertions. Start (SRJD) moves [(RSJD) (JRSD) (DJRS)]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42497,"title":"Pancake sorting","description":"Sort a stack of pancakes by flipping them using spatula.\r\n\r\n* There are _N_ pancakes with diameters _1:N_.\r\n* Spatula can be inserted anywhere in the stack and used to flip all the pancakes above.\r\n* Sort pancakes in increasing order.\r\n* Return a vector of places where spatula was inserted.\r\n* References: \u003chttp://www.math.illinois.edu/~dwest/openp/pancake.html math.illinois.edu\u003e, \u003chttps://en.wikipedia.org/wiki/Pancake_sorting wikipedia\u003e.\r\n\r\n\r\nExample (horizontal view):\r\n\r\n  Initial stack:  6 4 2 5 3 1,         (\",\" indicates position of spatula)\r\n  first flip:     1 3 5,2 4 6\r\n  second:         5 3 1 2 4,6\r\n  ...             4 2 1 3,5 6\r\n                  3 1 2,4 5 6\r\n                  2 1,3 4 5 6\r\n  sorted!         1 2 3 4 5 6\r\n  \r\n  positions of spatula from the begining: 6 3 5 4 3 2","description_html":"\u003cp\u003eSort a stack of pancakes by flipping them using spatula.\u003c/p\u003e\u003cul\u003e\u003cli\u003eThere are \u003ci\u003eN\u003c/i\u003e pancakes with diameters \u003ci\u003e1:N\u003c/i\u003e.\u003c/li\u003e\u003cli\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/li\u003e\u003cli\u003eSort pancakes in increasing order.\u003c/li\u003e\u003cli\u003eReturn a vector of places where spatula was inserted.\u003c/li\u003e\u003cli\u003eReferences: \u003ca href = \"http://www.math.illinois.edu/~dwest/openp/pancake.html\"\u003emath.illinois.edu\u003c/a\u003e, \u003ca href = \"https://en.wikipedia.org/wiki/Pancake_sorting\"\u003ewikipedia\u003c/a\u003e.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExample (horizontal view):\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eInitial stack:  6 4 2 5 3 1,         (\",\" indicates position of spatula)\r\nfirst flip:     1 3 5,2 4 6\r\nsecond:         5 3 1 2 4,6\r\n...             4 2 1 3,5 6\r\n                3 1 2,4 5 6\r\n                2 1,3 4 5 6\r\nsorted!         1 2 3 4 5 6\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003epositions of spatula from the begining: 6 3 5 4 3 2\r\n\u003c/pre\u003e","function_template":"function y = sort_pancakes(stack)\r\n  y = 1:numel(stack);\r\nend","test_suite":"%%\r\nx = 1:5;\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = [6 4 2 5 3 1];\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(12);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nx = randperm(13);\r\nfor spatula = sort_pancakes(x)\r\n  x(1:spatula) = flip(x(1:spatula));\r\nend\r\nassert(issorted(x))\r\n%%\r\nfor k = 1:20\r\n  x = randperm(k);\r\n  for spatula = sort_pancakes(x)\r\n    x(1:spatula) = flip(x(1:spatula));\r\n  end\r\n  assert(issorted(x))\r\nend","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":14358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":39,"created_at":"2015-08-06T13:42:18.000Z","updated_at":"2026-04-02T08:21:14.000Z","published_at":"2015-08-06T14:03:01.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort a stack of pancakes by flipping them using spatula.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e pancakes with diameters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e1:N\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSpatula can be inserted anywhere in the stack and used to flip all the pancakes above.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSort pancakes in increasing order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReturn a vector of places where spatula was inserted.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eReferences:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.math.illinois.edu/~dwest/openp/pancake.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emath.illinois.edu\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Pancake_sorting\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ewikipedia\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample (horizontal view):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Initial stack:  6 4 2 5 3 1,         (\\\",\\\" indicates position of spatula)\\nfirst flip:     1 3 5,2 4 6\\nsecond:         5 3 1 2 4,6\\n...             4 2 1 3,5 6\\n                3 1 2,4 5 6\\n                2 1,3 4 5 6\\nsorted!         1 2 3 4 5 6\\n\\npositions of spatula from the begining: 6 3 5 4 3 2]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":44952,"title":"Find MPG of Lightest Cars","description":"The file cars.mat contains a table named cars with variables Model, MPG, Horsepower, Weight, and Acceleration for several classic cars.\r\nLoad the MAT-file. Given an integer N, calculate the output variable mpg.\r\nOutput mpg should contain the MPG of the top N lightest cars (by Weight) in a column vector.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 103.65px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 51.825px; transform-origin: 406.5px 51.825px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42.55px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 21.275px; text-align: left; transform-origin: 383.5px 21.275px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 22.8917px 7.81667px; transform-origin: 22.8917px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe file\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 31.2667px 7.81667px; transform-origin: 31.2667px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 31.2667px 8.375px; transform-origin: 31.2667px 8.375px; \"\u003ecars.mat\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 77.6083px 7.81667px; transform-origin: 77.6083px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e contains a table named\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 15.6333px 7.81667px; transform-origin: 15.6333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 15.6333px 8.375px; transform-origin: 15.6333px 8.375px; \"\u003ecars\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 45.225px 7.81667px; transform-origin: 45.225px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e with variables\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 19.5417px 7.81667px; transform-origin: 19.5417px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 19.5417px 8.375px; transform-origin: 19.5417px 8.375px; \"\u003eModel\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003eMPG\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 39.0833px 7.81667px; transform-origin: 39.0833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 39.0833px 8.375px; transform-origin: 39.0833px 8.375px; \"\u003eHorsepower\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 23.45px 7.81667px; transform-origin: 23.45px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 23.45px 8.375px; transform-origin: 23.45px 8.375px; \"\u003eWeight\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 16.1917px 7.81667px; transform-origin: 16.1917px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 46.9px 7.81667px; transform-origin: 46.9px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 46.9px 8.375px; transform-origin: 46.9px 8.375px; \"\u003eAcceleration\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.65px 7.81667px; transform-origin: 11.65px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for several classic cars.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21.55px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.775px; text-align: left; transform-origin: 383.5px 10.775px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 111.667px 7.81667px; transform-origin: 111.667px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eLoad the MAT-file. Given an integer\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.90833px 7.81667px; transform-origin: 3.90833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.90833px 8.375px; transform-origin: 3.90833px 8.375px; \"\u003eN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 94.3583px 7.81667px; transform-origin: 94.3583px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, calculate the output variable\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003empg\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21.55px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 383.5px 10.775px; text-align: left; transform-origin: 383.5px 10.775px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 21.775px 7.81667px; transform-origin: 21.775px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOutput\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003empg\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 61.4167px 7.81667px; transform-origin: 61.4167px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e should contain the\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 11.725px 7.81667px; transform-origin: 11.725px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 11.725px 8.375px; transform-origin: 11.725px 8.375px; \"\u003eMPG\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 32.3833px 7.81667px; transform-origin: 32.3833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of the top\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 3.90833px 7.81667px; transform-origin: 3.90833px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 3.90833px 8.375px; transform-origin: 3.90833px 8.375px; \"\u003eN\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 54.1583px 7.81667px; transform-origin: 54.1583px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e lightest cars (by\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2.23333px 7.81667px; transform-origin: 2.23333px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 23.45px 7.81667px; transform-origin: 23.45px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 23.45px 8.375px; transform-origin: 23.45px 8.375px; \"\u003eWeight\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 64.7667px 7.81667px; transform-origin: 64.7667px 7.81667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e) in a column vector.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function mpg = sort_cars(N)\r\n mpg = N;\r\n\r\nend","test_suite":"%%\r\nfiletext = fileread('sort_cars.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp');\r\nassert(~illegal)\r\n\r\n\r\n%%\r\nN = 5\r\ntry % 2023a (and all prior versions?)\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdemos', 'carbig.mat'));\r\ncatch % 2023b\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdata', 'carbig.mat'));\r\nend\r\nModel = strtrim(string(Model));\r\ncars = table(Model, MPG, Horsepower, Weight, Acceleration);\r\nsave cars.mat cars\r\nassert(isequal(sort_cars(N),[35; 31; 39.1; 35.1; 31]));\r\n%%\r\nN = 6\r\ntry % 2023a (and all prior versions?)\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdemos', 'carsmall.mat'));\r\ncatch % 2023b\r\n load(fullfile(matlabroot, 'toolbox/stats/statsdata', 'carsmall.mat'));\r\nend\r\nModel = strtrim(string(Model));\r\ncars = table(Model, MPG, Horsepower, Weight, Acceleration);\r\nsave cars.mat cars\r\nassert(isequal(sort_cars(N),[33; 29.5; 26; 29; 38; 32]));\r\n","published":true,"deleted":false,"likes_count":77,"comments_count":51,"created_by":162851,"edited_by":223089,"edited_at":"2024-06-28T16:23:33.000Z","deleted_by":null,"deleted_at":null,"solvers_count":7553,"test_suite_updated_at":"2024-06-28T16:23:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-08-19T17:55:52.000Z","updated_at":"2026-04-03T12:20:01.000Z","published_at":"2019-08-29T18:06:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe file\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecars.mat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e contains a table named\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ecars\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with variables\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eModel\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMPG\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHorsepower\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWeight\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAcceleration\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e for several classic cars.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLoad the MAT-file. Given an integer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, calculate the output variable\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003empg\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003empg\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e should contain the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eMPG\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of the top\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eN\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e lightest cars (by\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWeight\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) in a column vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":42816,"title":"Sorting integers by their digits (Level 4)","description":"This is the next step up from \u003chttp://www.mathworks.com/matlabcentral/cody/problems/42815-sorting-integers-by-their-digits-level-3 Problem 42815\u003e.\r\n\r\nGiven a vector, v, of complex numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\r\n\r\nOnce all real digits have been used for sorting, it should continue with the imaginary part, which are further down the order.\r\n\r\nExample:\r\n\r\nv = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\r\n\r\nw = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\r\n\r\nAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\r\n\r\nNegative numbers take precedence over positive numbers.\r\n\r\nImaginary numbers should be treated as if they had a leading zero, because they have a zero real part.","description_html":"\u003cp\u003eThis is the next step up from \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/42815-sorting-integers-by-their-digits-level-3\"\u003eProblem 42815\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eGiven a vector, v, of complex numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/p\u003e\u003cp\u003eOnce all real digits have been used for sorting, it should continue with the imaginary part, which are further down the order.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003ev = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\u003c/p\u003e\u003cp\u003ew = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\u003c/p\u003e\u003cp\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/p\u003e\u003cp\u003eNegative numbers take precedence over positive numbers.\u003c/p\u003e\u003cp\u003eImaginary numbers should be treated as if they had a leading zero, because they have a zero real part.\u003c/p\u003e","function_template":"function w = soort(v)\r\n  w = v;\r\nend","test_suite":"%%\r\nv = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\r\nw_correct = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-246 -24680 2468 246 24 -2 24680 -24 -2468 2];\r\nw_correct = [-2 2 -24 24 -246 246 -2468 2468 -24680 24680];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = ones(1,100)*randi(100);\r\nw_correct = v;\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-0.22222 0.22 0.222 0.2 0.2222];\r\nw_correct = [0.2 0.22 0.222 0.2222 -0.22222];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [-6.28 4-12i 4.01+12i 4-13i 4+13i 4+14.9i 0-75i 0+391i 4-148i];\r\nw_correct = [0+391i 0-75i 4-12i 4-13i 4+13i 4-148i 4+14.9i 4.01+12i -6.28];\r\nassert(isequal(soort(v),w_correct))\r\n\r\n%%\r\nv = [];\r\nw_correct = [];\r\nassert(isequal(soort(v),w_correct))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":3,"created_by":15521,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":45,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":43,"created_at":"2016-04-20T20:15:04.000Z","updated_at":"2026-03-12T21:55:39.000Z","published_at":"2016-04-20T20:15:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the next step up from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/42815-sorting-integers-by-their-digits-level-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 42815\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector, v, of complex numbers (negative or positive), return a vector, w, by sorting v in ascending order, such that primary sorting is done by the first digit (representing the largest value), secondary sorting by the second digit (next largest value), and so on.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOnce all real digits have been used for sorting, it should continue with the imaginary part, which are further down the order.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev = [14.38 210+69i 80.42 3.14 0-15i 268 -14.38 210+64i 0+15i 1 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ew = [0-15i 0+15i 1 -14.38 14.38 210+64i 210+69i 268 3.14 80.42 80.44];\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAs shown above, in cases of multiple numbers starting with the same digits, such as 1 and 14.38, shorter numbers take precedence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNegative numbers take precedence over positive numbers.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImaginary numbers should be treated as if they had a leading zero, because they have a zero real part.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":795,"title":"Joining Ranges","description":"You are given a n-by-2 matrix. Each row represents a numeric range, e.g.\r\n\r\n  x = [0 5; 10 3; 20 15; 16 19; 25 25]\r\n  \r\ncontains ranges [0 5], [10 3], [20 15], [16 19], and [25 25]. Note that the first column does not always contain the smaller number. Join all overlapping ranges and return the sorted (both columns and all rows must be sorted) matrix of joined ranges\r\n\r\n  y = [0 10; 15 20; 25 25]\r\n\r\ni.e. ranges [0 5] and [10 3] are combined to [0 10], range [16 19] is completely overlapped by [15 20] and [25 25] is kept because it is a separate range.","description_html":"\u003cp\u003eYou are given a n-by-2 matrix. Each row represents a numeric range, e.g.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = [0 5; 10 3; 20 15; 16 19; 25 25]\r\n\u003c/pre\u003e\u003cp\u003econtains ranges [0 5], [10 3], [20 15], [16 19], and [25 25]. Note that the first column does not always contain the smaller number. Join all overlapping ranges and return the sorted (both columns and all rows must be sorted) matrix of joined ranges\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ey = [0 10; 15 20; 25 25]\r\n\u003c/pre\u003e\u003cp\u003ei.e. ranges [0 5] and [10 3] are combined to [0 10], range [16 19] is completely overlapped by [15 20] and [25 25] is kept because it is a separate range.\u003c/p\u003e","function_template":"function y = joinRanges(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [0 5; 10 3; 20 15; 16 19; 25 25];\r\ny_correct = [0 10;15 20;25 25];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [-10 -5; 0 -8; -1 5]; \r\ny_correct = [-10 5];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [-50 0; 0 50; 100 50; -50 -100]; \r\ny_correct = [-100 100];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n\r\n%%\r\nx = [99 51; -49 -1; -51 -99; 1 49]; \r\ny_correct = [-99 -51;-49 -1;1 49;51 99];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n\r\n%%\r\nx = [-inf inf]; \r\ny_correct = x;\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [0 -42; -inf -10; inf 42]; \r\ny_correct = [-Inf 0;42 Inf];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nx = [36.154 63.178; 12.007 -5.156; -0.519 17.651]; \r\ny_correct = [-5.156 17.651;36.154 63.178];\r\nassert(isequal(joinRanges(x),y_correct))\r\n\r\n%%\r\nassert(isempty(strfind(evalc('type joinRanges'), 'regexp')));","published":true,"deleted":false,"likes_count":9,"comments_count":3,"created_by":4976,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":399,"test_suite_updated_at":"2013-10-20T11:57:08.000Z","rescore_all_solutions":false,"group_id":12,"created_at":"2012-06-27T16:04:34.000Z","updated_at":"2026-02-17T06:56:17.000Z","published_at":"2012-06-27T16:10:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are given a n-by-2 matrix. Each row represents a numeric range, e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = [0 5; 10 3; 20 15; 16 19; 25 25]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003econtains ranges [0 5], [10 3], [20 15], [16 19], and [25 25]. Note that the first column does not always contain the smaller number. Join all overlapping ranges and return the sorted (both columns and all rows must be sorted) matrix of joined ranges\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[y = [0 10; 15 20; 25 25]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ei.e. ranges [0 5] and [10 3] are combined to [0 10], range [16 19] is completely overlapped by [15 20] and [25 25] is kept because it is a separate range.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":38,"title":"Return a list sorted by number of occurrences","description":"Given a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x.\r\nTies are resolved by a sort from lowest to highest.\r\nSo if\r\n x = [1 2 2 2 3 3 7 7 93]\r\nthen\r\n y = [2 3 7 1 93]","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 172.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 86.4333px; transform-origin: 407px 86.4333px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 318.5px 8px; transform-origin: 318.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 156.5px 8px; transform-origin: 156.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eTies are resolved by a sort from lowest to highest.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSo if\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e x = [1 2 2 2 3 3 7 7 93]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14px 8px; transform-origin: 14px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ethen\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 20.4333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 68px 8.5px; tab-size: 4; transform-origin: 68px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e y = [2 3 7 1 93]\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = popularity(x)\r\n  y = x\r\nend","test_suite":"%%\r\nx = [1 2 2 2 3 3 7 7 93]\r\ny_correct = [2 3 7 1 93];\r\nassert(isequal(popularity(x),y_correct))\r\n\r\n%%\r\nx = [-1 19 20 -1 -1 87 19 34 19 -1 21 87 20 10 20 34 19 -1];\r\ny_correct = [-1 19 20 34 87 10 21];\r\nassert(isequal(popularity(x),y_correct))\r\n\r\n%%\r\nx = repelem(1:5,1:5);\r\ny_correct = flip(1:5);\r\nassert(isequal(popularity(x),y_correct))","published":true,"deleted":false,"likes_count":19,"comments_count":2,"created_by":1,"edited_by":223089,"edited_at":"2022-10-08T16:12:27.000Z","deleted_by":null,"deleted_at":null,"solvers_count":2890,"test_suite_updated_at":"2022-10-08T16:12:27.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:22.000Z","updated_at":"2026-03-06T19:31:36.000Z","published_at":"2012-01-18T01:00:22.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTies are resolved by a sort from lowest to highest.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo if\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 2 2 2 3 3 7 7 93]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethen\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ y = [2 3 7 1 93]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":70,"title":"Alphabetize by last name","description":"Given a list of names in a cell array, sort the list by the last name. So if \n\n list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'}; \n\nthen the output is \n\n alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}\n","description_html":"\u003cp\u003eGiven a list of names in a cell array, sort the list by the last name. So if\u003c/p\u003e\u003cpre\u003e list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'}; \u003c/pre\u003e\u003cp\u003ethen the output is\u003c/p\u003e\u003cpre\u003e alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}\u003c/pre\u003e","function_template":"function alpha_list = alphabetize(list)\n  alpha_list = list;\nend","test_suite":"%%\nlist = {'Barney Google','Snuffy Smith','Dagwood Bumstead'};\nalpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}\nassert(isequal(alphabetize(list),alpha_list))\n\n%%\nlist = {'Harry Truman'\n    'Dwight Eisenhower'\n    'John F. Kennedy'\n    'Lyndon Johnson'\n    'Richard Nixon'\n    'Gerald Ford'\n    'Cleve Moler'\n    'Ronald Reagan'\n    'George Bush'\n    'Bill Clinton'\n    'George Bush'\n    'Barack Obama'};\nalpha_list = {'George Bush'\n    'George Bush'\n    'Bill Clinton'\n    'Dwight Eisenhower'\n    'Gerald Ford'\n    'Lyndon Johnson'\n    'John F. Kennedy'\n     'Cleve Moler'\n    'Richard Nixon'\n    'Barack Obama'\n    'Ronald Reagan'\n    'Harry Truman'}\nassert(isequal(alphabetize(list),alpha_list))","published":true,"deleted":false,"likes_count":17,"comments_count":8,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2342,"test_suite_updated_at":"2012-01-18T01:00:27.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:27.000Z","updated_at":"2026-03-10T16:48:02.000Z","published_at":"2012-01-18T01:00:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of names in a cell array, sort the list by the last name. So if\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'};]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethen the output is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1740,"title":"Find number patterns in rows of a matrix...","description":"So I think this may be a hard one, may be it was only hard for me!  So here is what it is, I will give a matrix, with some number of rows by 5 columns, to make it simpler I will not repeat any number in a *single row*, so all numbers in a *single rows* are unique. So you need to find up to 2, 3 or 4 numbers that are found in a *single row* that repeat in *other rows* and the amount of times they repeat in a given matrix. To make it a little better, you only need to display the rows/numbers that repeat at lease twice or more. Examples are the best way to show what to do:\r\n  \r\n          %p is the given matrix\r\n          p = [1 2 3 4 5;\r\n               2 3 4 5 1;\r\n               3 4 6 7 8;\r\n               1 2 4 3 5;\r\n               4 6 3 2 1];\r\n          %v is the amount of elements per row that are being checked to see if they repeat in another row\r\n          v = 4;\r\n        %Output:\r\n        out =\r\n        \r\n             1     2     3     4     4\r\n             1     2     3     5     3\r\n             1     2     4     5     3\r\n             1     3     4     5     3\r\n             2     3     4     5     3\r\n      %So the first to the fourth column are the four number that were found to repeat in rows of matrix p (any and all combination that can appear in the rows of the matrix p). The fifth column is the amount of times the that particular set of matrix out(?,1:4) appear in matrix p. for for row one in matrix out, 1,2,3 and 4 in any combination appear 4 time in the rows of matrix p.\r\n      \r\n      So more examples...\r\n      \r\n      p = [1 2 3 4 9;\r\n           2 3 1 4 8]\r\n      v = 4;\r\n      \r\n      out =\r\n           1     2     3     4     2\r\n    %so any combination of 1,2,3 and 4 appear 2 times in matrix p\r\n    \r\n    and another:\r\n    \r\n    p = [1 2 3 4 9;\r\n         2 3 1 4 8;\r\n         3 4 2 7 1]\r\n    v = 3;\r\n      \r\n    out =\r\n         1     2     3     3\r\n         1     2     4     3\r\n         1     3     4     3\r\n         2     3     4     3\r\n    %so this uses any combo of 3 values, so in this case out(?,1:3) are the number combos that can be found in matrix p, and the out(?,4) is the amount of times that those combos are found\r\n    \r\n    last example:\r\n    \r\n    p = [1 2 3 4 9;\r\n         2 3 1 4 8]\r\n    v = 2;\r\n    \r\n    out =\r\n         1     2     2\r\n         1     3     2\r\n         1     4     2\r\n         2     3     2\r\n         2     4     2\r\n         3     4     2\r\n    %so in this case only combos of out(?,1:2) are found and out(?,3) is the amounts of times that combo of out(?,1:2) is found in matrix p. so row four of matrix out (so out(4,:)...) shows that the combo of 2 and 3 are found 2 times in matrix p.\r\n\r\nNOTE: only display any row number combos that occur at least 2 times or more!\r\n\r\nI hope I gave enough instructions and explanation, if not please let me know and I will add to it! Thanks and good luck!","description_html":"\u003cp\u003eSo I think this may be a hard one, may be it was only hard for me!  So here is what it is, I will give a matrix, with some number of rows by 5 columns, to make it simpler I will not repeat any number in a \u003cb\u003esingle row\u003c/b\u003e, so all numbers in a \u003cb\u003esingle rows\u003c/b\u003e are unique. So you need to find up to 2, 3 or 4 numbers that are found in a \u003cb\u003esingle row\u003c/b\u003e that repeat in \u003cb\u003eother rows\u003c/b\u003e and the amount of times they repeat in a given matrix. To make it a little better, you only need to display the rows/numbers that repeat at lease twice or more. Examples are the best way to show what to do:\u003c/p\u003e\u003cpre\u003e          %p is the given matrix\r\n          p = [1 2 3 4 5;\r\n               2 3 4 5 1;\r\n               3 4 6 7 8;\r\n               1 2 4 3 5;\r\n               4 6 3 2 1];\r\n          %v is the amount of elements per row that are being checked to see if they repeat in another row\r\n          v = 4;\r\n        %Output:\r\n        out =\u003c/pre\u003e\u003cpre\u003e             1     2     3     4     4\r\n             1     2     3     5     3\r\n             1     2     4     5     3\r\n             1     3     4     5     3\r\n             2     3     4     5     3\r\n      %So the first to the fourth column are the four number that were found to repeat in rows of matrix p (any and all combination that can appear in the rows of the matrix p). The fifth column is the amount of times the that particular set of matrix out(?,1:4) appear in matrix p. for for row one in matrix out, 1,2,3 and 4 in any combination appear 4 time in the rows of matrix p.\u003c/pre\u003e\u003cpre\u003e      So more examples...\u003c/pre\u003e\u003cpre\u003e      p = [1 2 3 4 9;\r\n           2 3 1 4 8]\r\n      v = 4;\u003c/pre\u003e\u003cpre\u003e      out =\r\n           1     2     3     4     2\r\n    %so any combination of 1,2,3 and 4 appear 2 times in matrix p\u003c/pre\u003e\u003cpre\u003e    and another:\u003c/pre\u003e\u003cpre\u003e    p = [1 2 3 4 9;\r\n         2 3 1 4 8;\r\n         3 4 2 7 1]\r\n    v = 3;\u003c/pre\u003e\u003cpre\u003e    out =\r\n         1     2     3     3\r\n         1     2     4     3\r\n         1     3     4     3\r\n         2     3     4     3\r\n    %so this uses any combo of 3 values, so in this case out(?,1:3) are the number combos that can be found in matrix p, and the out(?,4) is the amount of times that those combos are found\u003c/pre\u003e\u003cpre\u003e    last example:\u003c/pre\u003e\u003cpre\u003e    p = [1 2 3 4 9;\r\n         2 3 1 4 8]\r\n    v = 2;\u003c/pre\u003e\u003cpre\u003e    out =\r\n         1     2     2\r\n         1     3     2\r\n         1     4     2\r\n         2     3     2\r\n         2     4     2\r\n         3     4     2\r\n    %so in this case only combos of out(?,1:2) are found and out(?,3) is the amounts of times that combo of out(?,1:2) is found in matrix p. so row four of matrix out (so out(4,:)...) shows that the combo of 2 and 3 are found 2 times in matrix p.\u003c/pre\u003e\u003cp\u003eNOTE: only display any row number combos that occur at least 2 times or more!\u003c/p\u003e\u003cp\u003eI hope I gave enough instructions and explanation, if not please let me know and I will add to it! Thanks and good luck!\u003c/p\u003e","function_template":"function out = findRowPattern(p,v)\r\n  out = [p v];\r\nend","test_suite":"%%\r\np = [1 2 3 4 5;\r\n     2 3 4 5 1;\r\n     3 4 6 7 8;\r\n     1 2 4 3 5;\r\n     4 6 3 2 1];\r\nv = 4;\r\nout = [1 2 3 4 4;\r\n       1 2 3 5 3;\r\n       1 2 4 5 3;\r\n       1 3 4 5 3;\r\n       2 3 4 5 3]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [1 2 3 4 9;\r\n     2 3 1 4 8]\r\nv = 4;\r\nout = [1 2 3 4 2]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [1 2 3 4 9;\r\n     2 3 1 4 8;\r\n     3 4 2 7 1]\r\nv = 3;\r\nout = [1 2 3 3;\r\n       1 2 4 3;\r\n       1 3 4 3;\r\n       2 3 4 3]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [1 2 3 4 9;\r\n     2 3 1 4 8]\r\nv = 2;\r\nout = [1 2 2;\r\n       1 3 2;\r\n       1 4 2;\r\n       2 3 2;\r\n       2 4 2;\r\n       3 4 2]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [15 23 68 49 88;\r\n     69 58 78 21 35;\r\n     10 23 21 35 88;\r\n     99 58 63 24 10;\r\n     64 28 14 33 58;\r\n     85 69 21 45 55;\r\n     99 24 76 49 33;\r\n     89 69 33 98 21;\r\n     99 10 21 55 58;\r\n     35 68 69 44 21;\r\n     21 69 35 46 33];\r\nv = 3;\r\nout = [21 35 69 3;\r\n     10 58 99 2;\r\n     21 33 69 2]\r\nassert(isequal(findRowPattern(p,v),out))\r\n%%\r\np = [15 23 68 49 88;\r\n     69 58 78 21 35;\r\n     10 23 21 35 88;\r\n     99 58 63 24 10;\r\n     64 28 14 33 58;\r\n     85 69 21 45 55;\r\n     99 24 76 49 33;\r\n     89 69 33 98 21;\r\n     99 10 21 55 58;\r\n     35 68 69 44 21;\r\n     21 69 35 46 33];\r\nv = 2;\r\n\r\nout = [21    69     5;\r\n       21    35     4;\r\n       35    69     3;\r\n       10    21     2;\r\n       10    58     2;\r\n       10    99     2;\r\n       21    33     2;\r\n       21    55     2;\r\n       21    58     2;\r\n       23    88     2;\r\n       24    99     2;\r\n       33    69     2;\r\n       58    99     2]\r\nassert(isequal(findRowPattern(p,v),out))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":"2013-07-23T17:11:41.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-23T16:51:20.000Z","updated_at":"2025-06-22T11:25:55.000Z","published_at":"2013-07-23T17:11:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo I think this may be a hard one, may be it was only hard for me! So here is what it is, I will give a matrix, with some number of rows by 5 columns, to make it simpler I will not repeat any number in a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle row\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, so all numbers in a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle rows\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are unique. So you need to find up to 2, 3 or 4 numbers that are found in a\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003esingle row\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that repeat in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eother rows\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and the amount of times they repeat in a given matrix. To make it a little better, you only need to display the rows/numbers that repeat at lease twice or more. Examples are the best way to show what to do:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[          %p is the given matrix\\n          p = [1 2 3 4 5;\\n               2 3 4 5 1;\\n               3 4 6 7 8;\\n               1 2 4 3 5;\\n               4 6 3 2 1];\\n          %v is the amount of elements per row that are being checked to see if they repeat in another row\\n          v = 4;\\n        %Output:\\n        out =\\n\\n             1     2     3     4     4\\n             1     2     3     5     3\\n             1     2     4     5     3\\n             1     3     4     5     3\\n             2     3     4     5     3\\n      %So the first to the fourth column are the four number that were found to repeat in rows of matrix p (any and all combination that can appear in the rows of the matrix p). The fifth column is the amount of times the that particular set of matrix out(?,1:4) appear in matrix p. for for row one in matrix out, 1,2,3 and 4 in any combination appear 4 time in the rows of matrix p.\\n\\n      So more examples...\\n\\n      p = [1 2 3 4 9;\\n           2 3 1 4 8]\\n      v = 4;\\n\\n      out =\\n           1     2     3     4     2\\n    %so any combination of 1,2,3 and 4 appear 2 times in matrix p\\n\\n    and another:\\n\\n    p = [1 2 3 4 9;\\n         2 3 1 4 8;\\n         3 4 2 7 1]\\n    v = 3;\\n\\n    out =\\n         1     2     3     3\\n         1     2     4     3\\n         1     3     4     3\\n         2     3     4     3\\n    %so this uses any combo of 3 values, so in this case out(?,1:3) are the number combos that can be found in matrix p, and the out(?,4) is the amount of times that those combos are found\\n\\n    last example:\\n\\n    p = [1 2 3 4 9;\\n         2 3 1 4 8]\\n    v = 2;\\n\\n    out =\\n         1     2     2\\n         1     3     2\\n         1     4     2\\n         2     3     2\\n         2     4     2\\n         3     4     2\\n    %so in this case only combos of out(?,1:2) are found and out(?,3) is the amounts of times that combo of out(?,1:2) is found in matrix p. so row four of matrix out (so out(4,:)...) shows that the combo of 2 and 3 are found 2 times in matrix p.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNOTE: only display any row number combos that occur at least 2 times or more!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eI hope I gave enough instructions and explanation, if not please let me know and I will add to it! Thanks and good luck!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"sorting\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"sorting\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"sorting\"","","\"","sorting","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f1943a2dd58\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f1943a2dcb8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f1943a2d3f8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f1943a2dfd8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f1943a2df38\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f1943a2de98\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f1943a2ddf8\u003e":"tag:\"sorting\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f1943a2ddf8\u003e":"tag:\"sorting\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"sorting\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"sorting\"","","\"","sorting","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f1943a2dd58\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f1943a2dcb8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f1943a2d3f8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f1943a2dfd8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f1943a2df38\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f1943a2de98\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f1943a2ddf8\u003e":"tag:\"sorting\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f1943a2ddf8\u003e":"tag:\"sorting\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":42715,"difficulty_rating":"easy"},{"id":56568,"difficulty_rating":"easy"},{"id":55005,"difficulty_rating":"easy"},{"id":58593,"difficulty_rating":"easy"},{"id":46108,"difficulty_rating":"easy"},{"id":46893,"difficulty_rating":"easy"},{"id":61030,"difficulty_rating":"easy"},{"id":43079,"difficulty_rating":"easy"},{"id":44266,"difficulty_rating":"easy"},{"id":431,"difficulty_rating":"easy"},{"id":61024,"difficulty_rating":"easy"},{"id":47508,"difficulty_rating":"easy"},{"id":54910,"difficulty_rating":"easy"},{"id":43609,"difficulty_rating":"easy"},{"id":45508,"difficulty_rating":"easy"},{"id":44899,"difficulty_rating":"easy"},{"id":1894,"difficulty_rating":"easy-medium"},{"id":46573,"difficulty_rating":"easy-medium"},{"id":44443,"difficulty_rating":"easy-medium"},{"id":43072,"difficulty_rating":"easy-medium"},{"id":44541,"difficulty_rating":"easy-medium"},{"id":1893,"difficulty_rating":"easy-medium"},{"id":247,"difficulty_rating":"easy-medium"},{"id":60426,"difficulty_rating":"easy-medium"},{"id":1844,"difficulty_rating":"easy-medium"},{"id":56523,"difficulty_rating":"easy-medium"},{"id":46576,"difficulty_rating":"easy-medium"},{"id":44261,"difficulty_rating":"easy-medium"},{"id":2344,"difficulty_rating":"easy-medium"},{"id":42809,"difficulty_rating":"easy-medium"},{"id":1687,"difficulty_rating":"easy-medium"},{"id":55285,"difficulty_rating":"easy-medium"},{"id":42815,"difficulty_rating":"easy-medium"},{"id":30,"difficulty_rating":"medium"},{"id":44538,"difficulty_rating":"medium"},{"id":45193,"difficulty_rating":"medium"},{"id":42811,"difficulty_rating":"medium"},{"id":42498,"difficulty_rating":"medium"},{"id":94,"difficulty_rating":"medium"},{"id":46582,"difficulty_rating":"medium"},{"id":57988,"difficulty_rating":"medium"},{"id":1056,"difficulty_rating":"medium"},{"id":1876,"difficulty_rating":"medium"},{"id":42497,"difficulty_rating":"medium"},{"id":44952,"difficulty_rating":"medium"},{"id":42816,"difficulty_rating":"medium"},{"id":795,"difficulty_rating":"medium"},{"id":38,"difficulty_rating":"medium"},{"id":70,"difficulty_rating":"medium"},{"id":1740,"difficulty_rating":"medium-hard"}]}}