{"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":44427,"title":"what's my tax amount this year ?","description":"given an annual salary x and a tax rate i calculate the amount that you have to pay.Example\r\n\r\n  x = 70000;\r\n  i=.10\r\n  y_correct =7000","description_html":"\u003cp\u003egiven an annual salary x and a tax rate i calculate the amount that you have to pay.Example\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = 70000;\r\ni=.10\r\ny_correct =7000\r\n\u003c/pre\u003e","function_template":"function tax = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%test 1\r\nx = 70000;\r\ni=.10;\r\ny_correct =7000\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n%%test 2\r\nx = 80000;\r\ni=.15;\r\ny_correct =12000;\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n%%test 3\r\nx = 90000;\r\ni=.20;\r\ny_correct = 18000\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n%%test 4\r\nx = 100000;\r\ni=.30;\r\ny_correct = 30000\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n","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":83,"test_suite_updated_at":"2017-12-02T15:09:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T15:06:30.000Z","updated_at":"2026-02-13T15:25:40.000Z","published_at":"2017-12-02T15:06: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\u003egiven an annual salary x and a tax rate i calculate the amount that you have to pay.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 = 70000;\\ni=.10\\ny_correct =7000]]\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":44330,"title":"Matrix element wise multiplication","description":"Take two incoming vectors, and multiply them element wise","description_html":"\u003cp\u003eTake two incoming vectors, and multiply them element wise\u003c/p\u003e","function_template":"function y = your_fcn_name(x,x1)\r\n  y = ...;\r\nend","test_suite":"%%\r\nx = [1 2; 3 4]; x1 = [4 3; 2 1];\r\ny_correct = [     4     6;     6     4];\r\nassert(isequal(your_fcn_name(x, x1),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":12852,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":115,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-14T17:37:43.000Z","updated_at":"2026-02-11T18:40:44.000Z","published_at":"2017-09-14T17:37: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\",\"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\u003eTake two incoming vectors, and multiply them element wise\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":46908,"title":"Product of elements in a column","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: 81px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 40.5px; transform-origin: 407px 40.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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eif x=[1 2 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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e        3 4 5\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=\"\"\u003e        1 2 1] do the product of all the elements in a column such that your answer should be y=[3 16 15]\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;3 4 5;1 2 1];\r\ny_correct = [3 16 15];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx =[1 8 9 4;1 26 7 5];\r\ny_correct = [1 208 63 20];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx =[10 20;30 40];\r\ny_correct = [300 800];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx =[10 30;20 40];\r\ny_correct = [200 1200];\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":628208,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":"2020-10-23T09:06:17.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-18T10:24:59.000Z","updated_at":"2026-02-13T18:28:35.000Z","published_at":"2020-10-23T09:06: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\u003eif x=[1 2 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        3 4 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e        1 2 1] do the product of all the elements in a column such that your answer should be y=[3 16 15]\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":43618,"title":"Multiply two polynomials p and q given in in vector representation.","description":"Multiply two polynomials p and q given in vector representation.\r\nExample \r\np=[-2     0     1    -1     3     2]\r\n\r\nq=[1 0 -1 2 4]\r\n\r\nresult=[-2     0     3    -5    -6     5    -1     0    16     8]","description_html":"\u003cp\u003eMultiply two polynomials p and q given in vector representation.\r\nExample \r\np=[-2     0     1    -1     3     2]\u003c/p\u003e\u003cp\u003eq=[1 0 -1 2 4]\u003c/p\u003e\u003cp\u003eresult=[-2     0     3    -5    -6     5    -1     0    16     8]\u003c/p\u003e","function_template":"function y = MulPoly(p,q)\r\n  y = x;\r\nend","test_suite":"%%\r\np=[-2     0     1    -1     3     2]\r\nq=[1 0 -1 2 4]\r\ny_correct =[-2     0     3    -5    -6     5    -1     0    16     8];\r\nassert(isequal(MulPoly(p,q),y_correct))\r\n%%\r\np=[-2     0     1     0    -3     1]\r\nq=[-1     0    -1     2     2]\r\ny_correct =[2     0     1    -4    -2     1     5    -7    -4     2];\r\nassert(isequal(MulPoly(p,q),y_correct))\r\n%%\r\np=[1     2     0     5     0     3]\r\nq=[3     2     5     1     0     2]\r\ny_correct =[3     8     9    26    12    36    15    15    13     0     6];\r\nassert(isequal(MulPoly(p,q),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T23:09:36.000Z","updated_at":"2026-02-17T14:22:13.000Z","published_at":"2016-10-24T23:09:36.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\u003eMultiply two polynomials p and q given in vector representation. Example p=[-2 0 1 -1 3 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\u003eq=[1 0 -1 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\u003eresult=[-2 0 3 -5 -6 5 -1 0 16 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":61121,"title":"Multiplying the Sums of Two Arrays","description":"Get two arrays, add the values within the array up, and then multiply the two total values. \r\n[2,3]*[3,6]\r\n5*18\r\n90","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); 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: 111px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 55.5px; transform-origin: 408px 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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=\"\"\u003eGet two arrays, add the values within the array up, and then multiply the two total 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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[2,3]*[3,6]\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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=\"\"\u003e5*18\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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=\"\"\u003e90\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = multiplySums(x,h)\r\n  y = x*h\r\nend","test_suite":"%%\r\nx = [1,2];\r\nh = [3,1];\r\ny_correct = 12;\r\nassert(isequal(multiplySums(x,h),y_correct))\r\n%%\r\nx = [1,0];\r\nh = [0];\r\ny_correct = 0\r\nassert(isequal(multiplySums(x,h),y_correct))\r\n%%\r\nx = [0,0,100]\r\nh = [0,2,9];\r\ny_correct = 1100;\r\nassert(isequal(multiplySums(x,h),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":5018771,"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":"2025-12-09T01:26:14.000Z","updated_at":"2026-02-26T11:37:46.000Z","published_at":"2025-12-09T01:26:14.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\u003eGet two arrays, add the values within the array up, and then multiply the two total 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\u003e[2,3]*[3,6]\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\u003e5*18\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\u003e90\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":44699,"title":"Prime Product","description":"My professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj such that it is a prime number, where 1 \u003c= i \u003c j \u003c= N.\r\n\r\nIf it's possible to find any value of ai * aj such that it is a prime number, then print the smallest value of such ai * aj, otherwise print -1.\r\n\r\n  x=[1 2 3]\r\ny = 2\r\n\r\n\r\n  x=[5 5 5 2]\r\ny = -1\r\n","description_html":"\u003cp\u003eMy professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj such that it is a prime number, where 1 \u0026lt;= i \u0026lt; j \u0026lt;= N.\u003c/p\u003e\u003cp\u003eIf it's possible to find any value of ai * aj such that it is a prime number, then print the smallest value of such ai * aj, otherwise print -1.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex=[1 2 3]\r\ny = 2\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ex=[5 5 5 2]\r\ny = -1\r\n\u003c/pre\u003e","function_template":"function y = prime_product(x)\r\n  % my first problem I created\r\nend","test_suite":"%%\r\nx = [1 2 3];\r\ny_correct = 2;\r\nassert(isequal(prime_product(x),y_correct))\r\n\r\n%%\r\nx = [5 2 5 2];\r\ny_correct = -1;\r\nassert(isequal(prime_product(x),y_correct))\r\n\r\n%%\r\nx = [1 63];\r\ny_correct = -1;\r\nassert(isequal(prime_product(x),y_correct))\r\n\r\n%% \r\nx = [ 3 6 234 1 623 234 ];\r\ny_correct = 3;\r\nassert(isequal(prime_product(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":195572,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":34,"test_suite_updated_at":"2018-07-30T18:29:12.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-07-18T20:13:31.000Z","updated_at":"2025-12-09T15:21:32.000Z","published_at":"2018-07-18T20:40:31.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\u003eMy professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj such that it is a prime number, where 1 \u0026lt;= i \u0026lt; j \u0026lt;= N.\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\u003eIf it's possible to find any value of ai * aj such that it is a prime number, then print the smallest value of such ai * aj, otherwise print -1.\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]\\ny = 2\\n\\nx=[5 5 5 2]\\ny = -1]]\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":55515,"title":"Find the remainder - 01","description":"Given an array of integers, find the remainder when the product of all the elements is divided by 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: 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: 307.5px 8px; transform-origin: 307.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven an array of integers, find the remainder when the product of all the elements is divided by N\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = rem_mul(x,N)\r\n  y = x;\r\nend","test_suite":"%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13 ];\r\nN=3;\r\ny_correct = 1;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13 ];\r\nN=5;\r\ny_correct = 0;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13 ];\r\nN=19;\r\ny_correct = 7;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13, 1298323, 1264, 92188212, 9928381832, 12723812313 ];\r\nN=19;\r\ny_correct = 15;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13, 1298323, 1264, 92188212, 9928381832, 12723812313 ];\r\nN=199;\r\ny_correct = 8;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124999112 ,13414123356262 ,2312414 ,4912412 ,235124124 ,131298, 1298323, 1264, 92188212, 9928381832, 12723812313 ]\r\nN=1990;\r\ny_correct = 1036;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":7,"created_by":363598,"edited_by":223089,"edited_at":"2022-10-14T07:04:51.000Z","deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2022-10-14T07:04:51.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-09-07T10:15:06.000Z","updated_at":"2025-11-29T16:40:34.000Z","published_at":"2022-09-07T10:23:25.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\u003eGiven an array of integers, find the remainder when the product of all the elements is divided by N\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":2230,"title":"Back to basics - array operations","description":"Without performing actual arithmetic operations on arrays, return feasibility of operation as true or false. True if given operation can be performed on given matrices, else false.\r\nExample\r\n Operation = 'Add'\r\n Matrices are:\r\n  a = magic(3);\r\n  b = [2 2; 2 2; 2 2]\r\nResult: false, since size of a and b should be same to perform \"Add\" operation.","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: 194.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 97.3667px; transform-origin: 407px 97.3667px; 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: 369.5px 8px; transform-origin: 369.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWithout performing actual arithmetic operations on arrays, return feasibility of operation as true or false. True if given operation can be performed on given matrices, else false.\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: 26.5px 8px; transform-origin: 26.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: 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: 52px 8.5px; transform-origin: 52px 8.5px; \"\u003e Operation = \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'Add'\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; perspective-origin: 40px 8.5px; transform-origin: 40px 8.5px; \"\u003e Matrices \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; \"\u003eare:\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: 60px 8.5px; tab-size: 4; transform-origin: 60px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e  a = magic(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: 84px 8.5px; tab-size: 4; 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  b = [2 2; 2 2; 2 2]\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: 247.5px 8px; transform-origin: 247.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eResult: false, since size of a and b should be same to perform \"Add\" operation.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = ArrayOperation(a,b,operation)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = magic(3);\r\ny = eye(3);\r\noperation = 'Add';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = magic(3);\r\ny = eye(2);\r\noperation = 'Add';\r\ny_correct = false;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = magic(3);\r\ny = repmat(3,3,3);\r\noperation = 'Multiply';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = magic(3);\r\ny = repmat(3,3,2);\r\noperation = 'Multiply';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Add';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Subtract';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = false;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(y,x,operation),y_correct))\r\n\r\n%%\r\nx = ones(3,2);\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = ones(5,7);\r\noperation = 'Multiply';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = ones(3,3);\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = false;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":"2022-02-22T05:49:00.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-03-03T22:31:03.000Z","updated_at":"2025-12-04T17:14:15.000Z","published_at":"2014-03-03T22:33:40.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\u003eWithout performing actual arithmetic operations on arrays, return feasibility of operation as true or false. True if given operation can be performed on given matrices, else false.\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[ Operation = 'Add'\\n Matrices are:\\n  a = magic(3);\\n  b = [2 2; 2 2; 2 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eResult: false, since size of a and b should be same to perform \\\"Add\\\" operation.\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":2432,"title":"Equation Times (of the day)","description":"Many times throughout the day can represent mathematical equations. In this problem, we focus on times that include the four basic operations (+,-,*,/). For example, 6:17 can be written as 6=1+7. Write a function that determines if the given time (restricted to three digits in 12-hour time, 1:00 to 9:59) is an equation time, and if so, which basic operation it uses. There are also four types of equations that are categorized here, and a given time can fit more than one category:\r\n\r\n - equation written forward, \"=\" doesn't coincide with \":\" --\u003e add 1 to output (e.g., 2:35, 2+3=5)\r\n\r\n - equation written forward, \"=\" does coincide with \":\" -- \u003e add 100 to output (e.g., 2:53, 2=5-3)\r\n\r\n - equation written backward, \"=\" doesn't coincide with \":\" --\u003e add 10 to output (e.g., 3:26, 6=2*3)\r\n\r\n - equation written backward, \"=\" does coincide with \":\" --\u003e add 1000 to output (e.g., 4:28, 8/2=4)\r\n\r\nNote that some of these combinations are tied to each other due to the commutative nature of + and * and the inverse relation of +,- and **,/. The output should be a 4x2 matrix with 0s or 1s in the first column dependent on whether each operation (+,-,*,/) is applicable to a given time and the totals in the second column. Examples include: \r\n\r\n4:22 | out = [1 1100; 1 1; 1 1100; 1 1]; since 4=2+2, 2+2=4; 4-2=2; 4=2*2, 2*2=4; 4/2=2.\r\n\r\n5:15 | out = [0 0; 0 0; 1 1111; 1 1001]; since 5*1=5, 5=1*5, 5*1=5, 5=1*5; 5/1=5, 5/1=5.\r\n\r\nThis problem is related to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day Problem 2431\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2433-consecutive-equation-times-of-the-day Problem 2433\u003e.","description_html":"\u003cp\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on times that include the four basic operations (+,-,*,/). For example, 6:17 can be written as 6=1+7. Write a function that determines if the given time (restricted to three digits in 12-hour time, 1:00 to 9:59) is an equation time, and if so, which basic operation it uses. There are also four types of equations that are categorized here, and a given time can fit more than one category:\u003c/p\u003e\u003cpre\u003e - equation written forward, \"=\" doesn't coincide with \":\" --\u0026gt; add 1 to output (e.g., 2:35, 2+3=5)\u003c/pre\u003e\u003cpre\u003e - equation written forward, \"=\" does coincide with \":\" -- \u0026gt; add 100 to output (e.g., 2:53, 2=5-3)\u003c/pre\u003e\u003cpre\u003e - equation written backward, \"=\" doesn't coincide with \":\" --\u0026gt; add 10 to output (e.g., 3:26, 6=2*3)\u003c/pre\u003e\u003cpre\u003e - equation written backward, \"=\" does coincide with \":\" --\u0026gt; add 1000 to output (e.g., 4:28, 8/2=4)\u003c/pre\u003e\u003cp\u003eNote that some of these combinations are tied to each other due to the commutative nature of + and * and the inverse relation of +,- and ,/. The output should be a 4x2 matrix with 0s or 1s in the first column dependent on whether each operation (+,-,*,/) is applicable to a given time and the totals in the second column. Examples include:\u003c/p\u003e\u003cp\u003e4:22 | out = [1 1100; 1 1; 1 1100; 1 1]; since 4=2+2, 2+2=4; 4-2=2; 4=2*2, 2*2=4; 4/2=2.\u003c/p\u003e\u003cp\u003e5:15 | out = [0 0; 0 0; 1 1111; 1 1001]; since 5*1=5, 5=1*5, 5*1=5, 5=1*5; 5/1=5, 5/1=5.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day\"\u003eProblem 2431\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2433-consecutive-equation-times-of-the-day\"\u003eProblem 2433\u003c/a\u003e.\u003c/p\u003e","function_template":"function out = equation_time(time)\r\n out = 0;\r\nend","test_suite":"%%\r\ntime = '4:22';\r\ny_correct = [1 1100;\r\n\t1 1;\r\n\t1 1100;\r\n\t1 1];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '2:38';\r\ny_correct = zeros(4,2);\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '5:15';\r\ny_correct = [0 0;\r\n\t0 0;\r\n\t1 1111;\r\n \t1 1001];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '1:23';\r\ny_correct = [1 11;\r\n\t1 1000;\r\n\t0 0;\r\n \t0 0];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '1:02';\r\ny_correct = zeros(4,2);\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '1:11';\r\ny_correct = [0 0;\r\n\t0 0;\r\n\t1 1111;\r\n \t1 1111];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '2:11';\r\ny_correct = [1 1100;\r\n\t1 1;\r\n\t0 0;\r\n \t0 0];\r\nassert(isequal(equation_time(time),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":79,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":45,"created_at":"2014-07-15T18:39:02.000Z","updated_at":"2026-01-15T14:29:10.000Z","published_at":"2014-07-15T18:39:02.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\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on times that include the four basic operations (+,-,*,/). For example, 6:17 can be written as 6=1+7. Write a function that determines if the given time (restricted to three digits in 12-hour time, 1:00 to 9:59) is an equation time, and if so, which basic operation it uses. There are also four types of equations that are categorized here, and a given time can fit more than one category:\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[ - equation written forward, \\\"=\\\" doesn't coincide with \\\":\\\" --\u003e add 1 to output (e.g., 2:35, 2+3=5)\\n\\n - equation written forward, \\\"=\\\" does coincide with \\\":\\\" -- \u003e add 100 to output (e.g., 2:53, 2=5-3)\\n\\n - equation written backward, \\\"=\\\" doesn't coincide with \\\":\\\" --\u003e add 10 to output (e.g., 3:26, 6=2*3)\\n\\n - equation written backward, \\\"=\\\" does coincide with \\\":\\\" --\u003e add 1000 to output (e.g., 4:28, 8/2=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\u003eNote that some of these combinations are tied to each other due to the commutative nature of + and * and the inverse relation of +,- and ,/. The output should be a 4x2 matrix with 0s or 1s in the first column dependent on whether each operation (+,-,*,/) is applicable to a given time and the totals in the second column. Examples include:\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\u003e4:22 | out = [1 1100; 1 1; 1 1100; 1 1]; since 4=2+2, 2+2=4; 4-2=2; 4=2*2, 2*2=4; 4/2=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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e5:15 | out = [0 0; 0 0; 1 1111; 1 1001]; since 5*1=5, 5=1*5, 5*1=5, 5=1*5; 5/1=5, 5/1=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\u003eThis problem is related to\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/2431-power-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2431\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/2433-consecutive-equation-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2433\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\"},{\"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":421,"title":"Multiply to the limit?","description":"If y = 4*x*x/pi/pi then what is the ultimate limiting result of (1+y/1/1)(1+y/3/3)(1+y/5/5)(1+y/7/7)... ... within 1000*eps?","description_html":"\u003cp\u003eIf y = 4*x*x/pi/pi then what is the ultimate limiting result of (1+y/1/1)(1+y/3/3)(1+y/5/5)(1+y/7/7)... ... within 1000*eps?\u003c/p\u003e","function_template":"function m = multiply(x)\r\n   y=4*x*x/pi/pi;\r\n   m=1; \r\n   for k=1:Inf\r\n      m=m*(1+y/(2*k-1)^2);\r\n   end\r\nend","test_suite":"%%\r\nx = 1.1;\r\nm = 1.6685185538222564;\r\nassert(abs(1-multiply(x)/m)\u003c1000*eps)\r\n%%\r\nx = pi;\r\nm = 11.591953275521519;\r\nassert(abs(1-multiply(x)/m)\u003c1000*eps)\r\n%%\r\nx = 1/pi;\r\nm = 1.0510897883672876;\r\nassert(abs(1-multiply(x)/m)\u003c1000*eps)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":5,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":"2012-03-14T05:01:51.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-27T07:20:29.000Z","updated_at":"2025-12-07T16:44:36.000Z","published_at":"2012-03-14T20:15:14.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\u003eIf y = 4*x*x/pi/pi then what is the ultimate limiting result of (1+y/1/1)(1+y/3/3)(1+y/5/5)(1+y/7/7)... ... within 1000*eps?\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":42985,"title":"Vector multiplication","description":"Given two row vectors, v1 and v2, each representing an integer, such that the vector elements are the digits from left to right, return a row vector v3, of the same format, that represents the product of the integers represented by v1 and v2.\r\n\r\nExample 1:\r\n\r\nv1 = [1 2]\r\n\r\nv2 = [5 0 0]\r\n\r\nv3 = [6 0 0 0]\r\n\r\nExample 2:\r\n\r\nv1 = [9 9]\r\n\r\nv2 = [9 9]\r\n\r\nv3 = [9 8 0 1]","description_html":"\u003cp\u003eGiven two row vectors, v1 and v2, each representing an integer, such that the vector elements are the digits from left to right, return a row vector v3, of the same format, that represents the product of the integers represented by v1 and v2.\u003c/p\u003e\u003cp\u003eExample 1:\u003c/p\u003e\u003cp\u003ev1 = [1 2]\u003c/p\u003e\u003cp\u003ev2 = [5 0 0]\u003c/p\u003e\u003cp\u003ev3 = [6 0 0 0]\u003c/p\u003e\u003cp\u003eExample 2:\u003c/p\u003e\u003cp\u003ev1 = [9 9]\u003c/p\u003e\u003cp\u003ev2 = [9 9]\u003c/p\u003e\u003cp\u003ev3 = [9 8 0 1]\u003c/p\u003e","function_template":"function v3 = vmultiply(v1,v2)\r\n  v3 = v1*v2;\r\nend","test_suite":"%%\r\nfiletext = fileread('vmultiply.m');\r\nassert(isempty(strfind(filetext,'regexp')))\r\nassert(isempty(strfind(filetext,'switch')))\r\n\r\n%%\r\nv1 = [1 2];\r\nv2 = [5 0 0];\r\nv3_correct = [6 0 0 0];\r\nassert(isequal(vmultiply(v1,v2),v3_correct))\r\nassert(isequal(vmultiply(v2,v1),v3_correct))\r\n\r\n%%\r\nv1 = [9 9];\r\nv2 = [9 9];\r\nv3_correct = [9 8 0 1];\r\nassert(isequal(vmultiply(v1,v2),v3_correct))\r\nassert(isequal(vmultiply(v2,v1),v3_correct))\r\n\r\n%%\r\nv1 = [8 3 4 5 7 1 6 9 4 0 2 0 2 1 5 8 9 4];\r\nv2 = [1 0 0 6 6 9 4 3 1 8 2 7 0 5 4 5 5];\r\nv3_correct = [8 4 0 1 5 8 5 8 2 5 5 9 5 7 5 5 3 3 8 6 7 6 3 6 6 1 1 1 5 0 1 7 7 0];\r\nassert(isequal(vmultiply(v1,v2),v3_correct))\r\nassert(isequal(vmultiply(v2,v1),v3_correct))","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":33,"test_suite_updated_at":"2016-09-09T08:36:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-09-09T07:51:09.000Z","updated_at":"2025-12-05T13:02:52.000Z","published_at":"2016-09-09T07:51: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\u003eGiven two row vectors, v1 and v2, each representing an integer, such that the vector elements are the digits from left to right, return a row vector v3, of the same format, that represents the product of the integers represented by v1 and v2.\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 1:\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\u003ev1 = [1 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\u003ev2 = [5 0 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev3 = [6 0 0 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample 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\u003ev1 = [9 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev2 = [9 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev3 = [9 8 0 1]\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":553,"title":"How to multiply?","description":"Imagine you are in 3012 Anno Domini, when everyone must learn how to multiply,\r\nand competing for the highly prestigious post of,\r\nChief Comptroller of Ylpitlum Corporation.\r\nYou are being tested via MATLAB Cody for multiplication of two positive integers X and Y,\r\nboth are fortunately in decimal system, and only a few dozen digits or less,\r\nand delivered as ASCII strings.\r\nPlease output the result Z in similar style.\r\nPlease adopt a general strategy, as X and Y may be changed later.\r\nPlease rename the function Z = ylpitlum(X,Y).\r\nFunction Template:\r\nfunction Z = ylpitlum(X,Y)\r\n   %  098765432109876543210987654321098765432109876543210987654321\r\n   X='170000000000000000000000000000';\r\n   Y='190000000000000000000000000000';\r\n   Z='32300000000000000000000000000000000000000000000000000000000';\r\nend","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: 346.933px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 173.467px; transform-origin: 407px 173.467px; vertical-align: baseline; \"\u003e\u003cul style=\"block-size: 204.333px; 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 102.167px; transform-origin: 391px 102.167px; 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: 254.5px 8px; transform-origin: 254.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eImagine you are in 3012 Anno Domini, when everyone must learn how to multiply,\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: 151.5px 8px; transform-origin: 151.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand competing for the highly prestigious post of,\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: 131px 8px; transform-origin: 131px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eChief Comptroller of Ylpitlum Corporation.\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: 76.5px 8px; transform-origin: 76.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou are being tested via\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"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=\"\"\u003eMATLAB Cody\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 154.5px 8px; transform-origin: 154.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for multiplication of two positive integers X and Y,\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: 233.5px 8px; transform-origin: 233.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\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: 96.5px 8px; transform-origin: 96.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand delivered as ASCII strings.\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: 129px 8px; transform-origin: 129px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePlease output the result Z in similar style.\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: 210.5px 8px; transform-origin: 210.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePlease adopt a general strategy, as X and Y may be changed later.\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: 141.5px 8px; transform-origin: 141.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePlease rename the function Z = ylpitlum(X,Y).\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: 60px 8px; transform-origin: 60px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFunction Template:\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 122.6px; 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 61.3px; transform-origin: 404px 61.3px; 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: 104px 8.5px; tab-size: 4; transform-origin: 104px 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: 36px 8.5px; text-decoration: none; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); transform-origin: 36px 8.5px; \"\u003efunction \u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 68px 8.5px; transform-origin: 68px 8.5px; \"\u003eZ = ylpitlum(X,Y)\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: 264px 8.5px; tab-size: 4; transform-origin: 264px 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   \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: 252px 8.5px; text-decoration: none; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); transform-origin: 252px 8.5px; \"\u003e%  098765432109876543210987654321098765432109876543210987654321\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: 152px 8.5px; tab-size: 4; transform-origin: 152px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e   X=\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: 128px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 128px 8.5px; \"\u003e'170000000000000000000000000000'\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: 152px 8.5px; tab-size: 4; transform-origin: 152px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e   Y=\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: 128px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 128px 8.5px; \"\u003e'190000000000000000000000000000'\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: 268px 8.5px; tab-size: 4; transform-origin: 268px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e   Z=\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: 244px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 244px 8.5px; \"\u003e'32300000000000000000000000000000000000000000000000000000000'\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: 12px 8.5px; tab-size: 4; transform-origin: 12px 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); text-decoration: none; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); \"\u003eend\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function Z = ylpitlum(X,Y)\r\n   %  098765432109876543210987654321098765432109876543210987654321\r\n   X='170000000000000000000000000000';\r\n   Y='190000000000000000000000000000';\r\n   Z='32300000000000000000000000000000000000000000000000000000000';\r\nend","test_suite":"%%\r\nX='170000000000000000000000000000';\r\nY='190000000000000000000000000000';\r\nZ='32300000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(Z,ylpitlum(X,Y)))\r\n\r\n%%\r\nX='235711131719';\r\nY='232931374143475359';\r\nZ='54904517812220391149679812121';\r\nassert(isequal(Z,ylpitlum(X,Y)))\r\n\r\n%%\r\nX='7657534422342987897979879745232234';\r\nY='9878765654343431233130980808776767';\r\nZ='75646988048394475543709477144832189651639589891288011407029878707478';\r\nassert(isequal(Z,ylpitlum(X,Y)))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":82,"test_suite_updated_at":"2021-11-28T17:15:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-04-03T06:24:52.000Z","updated_at":"2026-02-10T19:25:06.000Z","published_at":"2012-04-03T06:24:52.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=\\\"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\u003eImagine you are in 3012 Anno Domini, when everyone must learn how to multiply,\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\u003eand competing for the highly prestigious post of,\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\u003eChief Comptroller of Ylpitlum Corporation.\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\u003eYou are being tested via\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\u003eMATLAB Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for multiplication of two positive integers X and Y,\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\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\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\u003eand delivered as ASCII strings.\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\u003ePlease output the result Z in similar style.\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\u003ePlease adopt a general strategy, as X and Y may be changed later.\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\u003ePlease rename the function Z = ylpitlum(X,Y).\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\u003eFunction Template:\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 Z = ylpitlum(X,Y)\\n   %  098765432109876543210987654321098765432109876543210987654321\\n   X='170000000000000000000000000000';\\n   Y='190000000000000000000000000000';\\n   Z='32300000000000000000000000000000000000000000000000000000000';\\nend]]\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":44262,"title":"Multivariate polynomials - overload multiplication","description":"Problems \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44260-multivariate-polynomials-convert-monomial-form-to-array 44260\u003e and \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44261-sort-multivariate-monomials 44261\u003e work with a monomial representation of multivariate polynomials. This has two parts, a matrix |exponents| with a row of exponents for each monomial, and a column vector |coefficients| with a coefficient for each monomial.\r\n\r\nIt would be nice to define polynomials so they can be multiplied using simple notation:\r\n\r\n  p = p1*p2;\r\n\r\nThis can be done by \u003chttps://www.mathworks.com/help/matlab/matlab_oop/user-defined-classes.html defining a class\u003e |mPoly| with two properties, |exponents| and |coefficients|, and two methods: a \u003chttps://www.mathworks.com/help/matlab/matlab_oop/class-constructor-methods.html constructor\u003e with the syntax\r\n\r\n  p = mPoly(exponents, coefficients)\r\n\r\nand a method \u003chttps://www.mathworks.com/help/matlab/ref/mtimes.html?searchHighlight=mtimes\u0026s_tid=doc_srchtitle mtimes\u003e for multiplying two polynomials. You can assume that the polynomials being multiplied have the same number of variables.\r\n","description_html":"\u003cp\u003eProblems \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44260-multivariate-polynomials-convert-monomial-form-to-array\"\u003e44260\u003c/a\u003e and \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44261-sort-multivariate-monomials\"\u003e44261\u003c/a\u003e work with a monomial representation of multivariate polynomials. This has two parts, a matrix \u003ctt\u003eexponents\u003c/tt\u003e with a row of exponents for each monomial, and a column vector \u003ctt\u003ecoefficients\u003c/tt\u003e with a coefficient for each monomial.\u003c/p\u003e\u003cp\u003eIt would be nice to define polynomials so they can be multiplied using simple notation:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ep = p1*p2;\r\n\u003c/pre\u003e\u003cp\u003eThis can be done by \u003ca href = \"https://www.mathworks.com/help/matlab/matlab_oop/user-defined-classes.html\"\u003edefining a class\u003c/a\u003e \u003ctt\u003emPoly\u003c/tt\u003e with two properties, \u003ctt\u003eexponents\u003c/tt\u003e and \u003ctt\u003ecoefficients\u003c/tt\u003e, and two methods: a \u003ca href = \"https://www.mathworks.com/help/matlab/matlab_oop/class-constructor-methods.html\"\u003econstructor\u003c/a\u003e with the syntax\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ep = mPoly(exponents, coefficients)\r\n\u003c/pre\u003e\u003cp\u003eand a method \u003ca href = \"https://www.mathworks.com/help/matlab/ref/mtimes.html?searchHighlight=mtimes\u0026s_tid=doc_srchtitle\"\u003emtimes\u003c/a\u003e for multiplying two polynomials. You can assume that the polynomials being multiplied have the same number of variables.\u003c/p\u003e","function_template":"classdef mPoly \r\n    %MPOLY Class of multivariate polynomials\r\n    \r\n    properties\r\n        exponents\r\n        coefficients\r\n    end\r\n    \r\n    methods\r\n        function p = mPoly(ex,co)\r\n        end\r\n        function p = mtimes(p1,p2)\r\n        end\r\n    end\r\n    \r\nend\r\n","test_suite":"%% Test polyMult\r\nfiletext = fileread('mPoly.m');\r\nassert(~contains(filetext,'regexp'))\r\n\r\n%% p1 = A, p2 = B\r\nc1 = randi(1000); c2 = randi(1000);\r\ne = 0;\r\np1 = mPoly(e,c1);\r\np2 = mPoly(e,c2);\r\np = p1*p2;\r\nassert(isequal(c1*c2,p.coefficients))\r\nassert(isequal(e,p.exponents))\r\n\r\n%% p1 = y-x^2, p2 = x-2\r\ne1 = [2 0; 0 1];\r\nc1 = [-1; 1];\r\ne2 = [1 0; 0 0];\r\nc2 = [1; -2];\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np = p1*p2;\r\n\r\n[e,idx] = unique(p.exponents,'rows');\r\nc = p.coefficients(idx);\r\nassert(isequal(e,[0 1; 1 1; 2 0; 3 0]))\r\nassert(isequal(c,[-2; 1; 2; -1]))\r\n\r\n%% p1 = y-x^2, p2 = z-2\r\ne1 = [0 1 0; 2 0 0];\r\nc1 = [1; -1];\r\ne2 = [0 0 1; 0 0 0];\r\nc2 = [1; -2];\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np = p1*p2;\r\n\r\n[e,idx] = unique(p.exponents,'rows');\r\nc = p.coefficients(idx);\r\nassert(isequal(e,[0 1 0; 0 1 1; 2 0 0; 2 0 1]))\r\nassert(isequal(c,[-2; 1; 2; -1]))\r\n\r\n\r\n%% p1 = z-x^3, p2 = x^2+y^2+z^2-1\r\ne1 = [0 0 1; 3 0 0];\r\nc1 = [1; -1];\r\ne2 = [2 0 0; 0 2 0; 0 0 2; 0 0 0];\r\nc2 = [1; 1; 1; -1];\r\n\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np = p1*p2;\r\n\r\n[e,idx] = unique(p.exponents,'rows');\r\nc = p.coefficients(idx);\r\nassert(isequal(e,[0 0 1; 0 0 3; 0 2 1; 2 0 1; 3 0 0; 3 0 2; 3 2 0; 5 0 0]))\r\nassert(isequal(c,[-1 1 1 1 1 -1 -1 -1]'))\r\n\r\n%% Commutative\r\nc1 = randi(1000,[2 1]);\r\ne1 = randi(1000,[2 2]);\r\nc2 = randi(1000,[3 1]);\r\ne2 = randi(1000,[3 2]);\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np12 = p1*p2;\r\np21 = p2*p1;\r\n[e12,i12] = unique(p12.exponents,'rows');\r\n[e21,i21] = unique(p21.exponents,'rows');\r\nc12 = p12.coefficients(i12);\r\nc21 = p21.coefficients(i21);\r\nassert(isequal(e12,e21))\r\nassert(isequal(c12,c21))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":1011,"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":"2017-07-14T04:04:05.000Z","updated_at":"2025-12-22T13:16:38.000Z","published_at":"2017-07-14T04:04:05.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\u003eProblems\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-multivariate-polynomials-convert-monomial-form-to-array\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44260\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44261-sort-multivariate-monomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44261\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e work with a monomial representation of multivariate polynomials. This has two parts, a matrix\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\u003eexponents\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with a row of exponents for each monomial, and a column vector\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\u003ecoefficients\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with a coefficient for each 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\u003eIt would be nice to define polynomials so they can be multiplied using simple notation:\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 = p1*p2;]]\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 can be done by\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/help/matlab/matlab_oop/user-defined-classes.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edefining a class\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:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emPoly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with two properties,\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\u003eexponents\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\u003ecoefficients\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and two methods: a\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/help/matlab/matlab_oop/class-constructor-methods.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003econstructor\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e with the syntax\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 = mPoly(exponents, coefficients)]]\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\u003eand a method\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/help/matlab/ref/mtimes.html?searchHighlight=mtimes\u0026amp;s_tid=doc_srchtitle\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emtimes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for multiplying two polynomials. You can assume that the polynomials being multiplied have the same number of variables.\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":44263,"title":"Multivariate polynomials - emulate symbolic form","description":"In \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44262-multivariate-polynomials-overload-multiplication Problem 44262\u003e I asked you to create a class |mPoly| with overloaded multiplication, so a product of two polynomials can be expressed in the form |p = p1*p2|. However, the method of constructing these polynomials is still somewhat unintuitive. In the \u003chttps://www.mathworks.com/products/symbolic.html Symbolic Math Toolbox\u003e, one can simply define some variables,\r\n\r\n  syms x y z\r\n\r\nand then create a polynomial:\r\n\r\n  p = 2*x*y + 3*x^5*z;\r\n\r\nWe would like to do something like that here. As a start, create a class |mPolySym| with properties |exponents| and |coefficients|, and |varnames|,  where the first two properties are the same as in previous problems and |varnames| is a \u003chttps://www.mathworks.com/help/matlab/characters-and-strings.html string array\u003e. The constructor should accept a numeric, char or string input, e.g.,\r\n\r\n  x = mPolySym('x')\r\n\r\n  x = \r\n\r\n  mPolySym with properties:\r\n\r\n        varnames: \"x\"\r\n       exponents: 1\r\n    coefficients: 1\r\n\r\n  r = mPolySym(pi)\r\n\r\n  r = \r\n\r\n  mPolySym with properties:\r\n\r\n        varnames: [0×0 string]\r\n       exponents: 1\r\n    coefficients: 3.1416\r\n\r\nAlso modify the method |mtimes| from the previous problem so it can multiply polynomials with different variable names.","description_html":"\u003cp\u003eIn \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44262-multivariate-polynomials-overload-multiplication\"\u003eProblem 44262\u003c/a\u003e I asked you to create a class \u003ctt\u003emPoly\u003c/tt\u003e with overloaded multiplication, so a product of two polynomials can be expressed in the form \u003ctt\u003ep = p1*p2\u003c/tt\u003e. However, the method of constructing these polynomials is still somewhat unintuitive. In the \u003ca href = \"https://www.mathworks.com/products/symbolic.html\"\u003eSymbolic Math Toolbox\u003c/a\u003e, one can simply define some variables,\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003esyms x y z\r\n\u003c/pre\u003e\u003cp\u003eand then create a polynomial:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ep = 2*x*y + 3*x^5*z;\r\n\u003c/pre\u003e\u003cp\u003eWe would like to do something like that here. As a start, create a class \u003ctt\u003emPolySym\u003c/tt\u003e with properties \u003ctt\u003eexponents\u003c/tt\u003e and \u003ctt\u003ecoefficients\u003c/tt\u003e, and \u003ctt\u003evarnames\u003c/tt\u003e,  where the first two properties are the same as in previous problems and \u003ctt\u003evarnames\u003c/tt\u003e is a \u003ca href = \"https://www.mathworks.com/help/matlab/characters-and-strings.html\"\u003estring array\u003c/a\u003e. The constructor should accept a numeric, char or string input, e.g.,\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = mPolySym('x')\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ex = \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003emPolySym with properties:\r\n\u003c/pre\u003e\u003cpre\u003e        varnames: \"x\"\r\n       exponents: 1\r\n    coefficients: 1\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003er = mPolySym(pi)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003er = \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003emPolySym with properties:\r\n\u003c/pre\u003e\u003cpre\u003e        varnames: [0×0 string]\r\n       exponents: 1\r\n    coefficients: 3.1416\u003c/pre\u003e\u003cp\u003eAlso modify the method \u003ctt\u003emtimes\u003c/tt\u003e from the previous problem so it can multiply polynomials with different variable names.\u003c/p\u003e","function_template":"classdef mPolySym\r\n    properties\r\n        varnames\r\n        exponents\r\n        coefficients\r\n    end\r\n    \r\n    methods\r\n        function p = mPolySym(s)\r\n        end\r\n        \r\n        function p = mtimes(p1,p2)\r\n        end            \r\n    end\r\n    \r\nend\r\n\r\n","test_suite":"%% Test mPolySym\r\nfiletext = fileread('mPolySym.m');\r\nassert(~contains(filetext,'regexp'))\r\n\r\n\r\n%%\r\nr = randi(1000);\r\nx = mPolySym(r);\r\nassert(isempty(x.varnames))\r\nassert(isequal(x.exponents,0))\r\nassert(isequal(x.coefficients,r))\r\n\r\n%%\r\nr = randi(1000);\r\nx = mPolySym('x');\r\ny = r*x;\r\nassert(isequal(y.varnames,\"x\"))\r\nassert(isequal(y.exponents,1))\r\nassert(isequal(y.coefficients,r))\r\nassert(isequal(r*x,x*r))\r\n\r\n%%\r\nx = mPolySym('x');\r\ny = mPolySym(\"y\");\r\nz = mPolySym('z');\r\nw = x*y*z;\r\nassert(isequal(w.varnames,[\"x\" \"y\" \"z\"]))\r\nassert(isequal(w.exponents,[1 1 1]))\r\nassert(isequal(w.coefficients,1))\r\n\r\n%%\r\nm = randi(5);\r\nn = randi(4);\r\nx = mPolySym(\"x\");\r\ny = mPolySym(\"y\");\r\np = [repmat(x,1,m) repmat(y,1,n)];\r\np = p(randperm(length(p)));\r\nr = randi(1000);\r\np_prod = r;\r\nfor ii=1:length(p)\r\n    p_prod = p_prod*p(ii);\r\nend\r\ns = randi(1000);\r\np_prod = p_prod*s;\r\nassert(isequal(p_prod.varnames,[\"x\" \"y\"]))\r\nassert(isequal(p_prod.exponents,[m n]))\r\nassert(isequal(p_prod.coefficients,r*s))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":1011,"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":"2017-07-14T23:13:17.000Z","updated_at":"2025-12-22T13:23:36.000Z","published_at":"2017-07-14T23:13:34.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/44262-multivariate-polynomials-overload-multiplication\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44262\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e I asked you to create a class\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\u003emPoly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with overloaded multiplication, so a product of two polynomials can be expressed in the form\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 = p1*p2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. However, the method of constructing these polynomials is still somewhat unintuitive. In 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=\\\"https://www.mathworks.com/products/symbolic.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSymbolic Math Toolbox\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, one can simply define some variables,\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[syms x y z]]\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\u003eand then create a polynomial:\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 = 2*x*y + 3*x^5*z;]]\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\u003eWe would like to do something like that here. As a start, create a class\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\u003emPolySym\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with properties\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\u003eexponents\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\u003ecoefficients\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\u003evarnames\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, where the first two properties are the same as in previous problems 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\u003evarnames\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a\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/help/matlab/characters-and-strings.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estring array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. The constructor should accept a numeric, char or string input, 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 = mPolySym('x')\\n\\nx = \\n\\nmPolySym with properties:\\n\\n        varnames: \\\"x\\\"\\n       exponents: 1\\n    coefficients: 1\\n\\nr = mPolySym(pi)\\n\\nr = \\n\\nmPolySym with properties:\\n\\n        varnames: [0×0 string]\\n       exponents: 1\\n    coefficients: 3.1416]]\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\u003eAlso modify the method\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\u003emtimes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e from the previous problem so it can multiply polynomials with different variable names.\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":53705,"title":"Multiply Large Hexadecimal Numbers ","description":"Multiply two large hexadecimal numbers together and output the hexadecimal representation of the result.\r\nFor example:\r\na='abcdef123456789';\r\nb='987654321fedcba';\r\nr=multiply(a,b)\r\nr =\r\n\r\n    '6651af60378fa86ce04c93a854f58a'","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: 183.625px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 91.8125px; transform-origin: 407px 91.8125px; 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eMultiply two large hexadecimal numbers together and output the hexadecimal representation of the result.\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=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 122.625px; 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 61.3125px; transform-origin: 404px 61.3125px; 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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ea=\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); \"\u003e'abcdef123456789'\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eb=\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); \"\u003e'987654321fedcba'\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003er=multiply(a,b)\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003er =\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; 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.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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\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); \"\u003e'6651af60378fa86ce04c93a854f58a'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = multiply(a,b)\r\n  y = a*b;\r\nend","test_suite":"%%\r\na='abcdef123456789';\r\nb='987654321fedcba';\r\nr_correct='6651af60378fa86ce04c93a854f58a';\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='abcdef123456789987654321123456789987654321abcabcefef987654321';\r\nb='987654321fedcbaabcdef123456789987654321fedcba';\r\nr_correct='6651af60378fa879c1e46f2d0a75920a109ee4df46b8d28d4a5570241a4a083fea6f165773615145bebeb95db05fefac6a410121fa';\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='abcdef123456789987654321123456789987654321abcabcefef987654321987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba';\r\nb='987654321fedcbaabcdef123456789987654321fedcbaabcdef123456789987654321123456789987654321abcabcefef987654321987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcbaabcdef123456789987654321123456789987654321abcabcefef987654321987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba';\r\nr_correct='6651af60378fa879c1e46f2d0a75920a109ee4df46b8d9c2168621697fb3ffb9a6014131ea0389ad6a4250890b58ccd1a4c35a906ecb65e1f3b97bd284d991e57c42e0a21a8d890fae70dba6e105ae662d64ebc602da3c920cd937e65f652252d4da9f54a95bb71db0e6f5074e34385cfdc4df910f042e70ed5e5a608146f508289e0f89f4fec680b592bcbe32f9430c76a2b471c0f01e1ebaa30a677bd251d2c688c230b7743079f60cf128fb9b3944d757f0b3c984c6145a131dab1ecbe15fec936f7e3c380d263c6e7419d63127e19c767c1f95299175d6a55fcb3058805f253f488d2fd4aa53f500226a193445700dedb325c907079054a6fc67fbef8803cbfc7ed80e762e7fb83f45098d2a245b3fd6969cc51b1c6c52154b018a6c97ee985ad58a9a29cf3c56f5e2bdd8a42ef14bb9ffd0539a5ea9c1b4ccf7eea7b4481f929ff8198c142c3e6f9ddb5d3cdd610f04d405ba320e0f96265f029139cdce2367d148f1ea6d13a2920f91f9a26024d3c6c6130d7b54cf1ecbe15fec936f7e3c380d263c6e7419d63127e19c7674eac8f8e030713b6dfe40712981ba9a80e8e2fcb8cb5d3394418c5bd56a10b726ee40651b281647053f5eadcaa51a7ec08e351f4c9224d43d54d8bbdcfcd6a827faca761b16ef5c8600552d8d73996a35fc538953cfc5a0ab841e485f2b028aeb591f899eeff1e6ce942da3508c1aa60dadf4f603cb5d15f663c0449406dd7efc609a4be2a93d97763f9576e0b765acee69a28ef4e14b5e6ff8f03a81a540d2fcab10b9d6bf3a0cefbdd7beaa6f6d64d224a6f710a41fffeb3683724';\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='b828e27fb98e8eb3c9dbad17cafc174fa5bec23c5a9b81f4ad16ea69726681312426326f418a553655c7f76de813a19f823cce2e4bd59538172c449972bfb324a9eaea441dd6d357417d7137fc4524e4be7e4abf11c36dac6a4cfc64993ce9bbb589149b7b8cb5d4b52a1685dc7b9825dde3c5e2e2e393a47d9cfc6386c58b9d5613ab9394ca3b295fc7759842a7c41479a16a67d83269fbd2d6182e56c9e869ae19fcea7e2f756f2358827341d17bf21c18f632d8518e9ea8f354385b81a512263e566f8ffab7dfb53476af4f46e93fd7dd7'\r\nb='f73722dfd9c5dcdfd728baf831676461cb388df9a49d5153262be72744bc2e819b76c22db8a1a7d8cafc77f9b429e2c5df38e4c4c1c3589b9cfe9285e414563cac3992e9e43a5949a1b751d6839b3537df82bf217646a7abfa48e8312513849cb639eb91835d5c34d7ae144d13de445617e8a2282be4e44e2e4ee9ce6fe9c44246559d486b9afdf39e66ce6ef535ff3e28d71c29bdc9867ed111ccc998273281748f5b72bb65bd645691b1247ab69aad27fce262fc7aa28b3fe464eb329a856d233a8687979c25dbd6aa334ceb78b79867ba9f5f38d188e1d166ba528c3b11cad21c3ec1fafd65261767ad7c925c56c7ec284a6428eb7a7655855a5724d39976db2b95b4de8d7de1f4e8b61d4dba8dc16ae7be5a1c88ef73ff14f56c71d34a35dbb1bc3e349228182cc285ffa86182c5fe118f9d1431ef97b9349de9a1534b417b38a1bcaa57452b165e96b11112cb59959757a4391ff7b776e88fa5a5b9af93aad983aa96dd27573455f36e3144866c1633f2efff756792bc2b7bae32f39c536a3ec65534946693d6ae86c4f986c8b48f4d73d3f7a44ed75271a1552e8231aec26fccf'\r\nr_correct='b1d71c685bd4ab906c23d7206d1747e1abac54768849561a9cf0c34d464a758a8c3d5c0fa7b4ee5472aab583b934f111f0e419637c894323424c45c74892e9c5a3566dead652f0147cfe09687dbf835a3125439197562f6e684f8e73842c6bd6fbc1ac7225db2179f334c318c4815d5ce395df374a74ac0cf259113e31beabe2f80fff2c8a1d2f472c4f36af26427ebd2e0cd5d92e88d9bfc952579544aef0907e19d3a8224677b9ab2558450713d49029cd180da291febb957d1e96829ef4e82e2ad4e5ec1e3e291c709d17ee6e12fde69be843ba9e05951182dbb80990ccb356221f2039c9487ce02bf8aa9d9fcf0be867c3ad904f029cab6b524d1136cbae33b3a57f92026a7490fe6f7453725ef7913d60e683fe3e9e53b6e44cdc8a0395675e3de4d451226ce17940b5391cf43122d7a74a2e34d4daafac7bddaa7c141dbff7a1b3dafe9a7cde0acc7657fea0ad14ff0dfc4dde3f2c4db49a84ff11c663f19068a84f1d7a454e5a2aad5f6639f4393bec19777232537651ffdd4a77c25b88188479ebe9bcc92ed0a2c608a638e6be157907a076c87f3e142b47074f385529c842ee53d35ccc1fbac357b90c81d2dda0358a52bcaf65cd7e57dc3d4768f6907bb645f25e72592c198b35b5ddc03a4ba02f57ca5d2113fb54b242b5506c8ccc0bb98100b4cf0c09d42f63ac4377e9bca67896486ef7e7de6d2364cd71ace868bc9642e165ecb5394ba2bd8e0d09f83bd7c00f9e4b1ba458a95361f18eae88ec0ef41d78c901ab04ae259e9b6e9db1e7c8f28835ed6eb9c3f3699778d57358f2e62fe2a6d5361ae5a74b1fe3d95144e59bff95e9a0aacd23f241f2892c21615c466fccf7079177d73212a3bfdd6e51539013c264d9'\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='6cfe54496998b194774d118c8cab3586bb98347fccfca4c58286a275c9ab6b25d22af41a7b5afa4e427993ce51981c44c5715aeecfb1c2ce6b9b2a2dcf348667c656ea942efd5a69ed73f4fa19391d328e812595996ec66f7b8debfec112d3f5ea1936376a4d59e7615814e985df5372b856763e511872678c245d6b8968454e67fc65ea56f5b4c3d3852ae684fe3f2327f581d1a621dffafb871458924a42a85124f6b222f52a317b678742ad4f189c7245cc84f1a3171479764d1cda1e2e555c44f1e974ec53c8579d1132fddd57b9c6b273314b3b326c36b984bdd892e96645a94ce3cba982e9a1a2bcd5a2e88672b2992435a758f218aa7f452a83a2ade5eb2b617f6172f5d3ba9795f48d393118117249f61ce86d68fb9424e46366cc191a586befae3f26ef7412c29d7153483aa4bc1bba73a953ce824d3b733b9d9e3edb9195222472cb6164b793f22bdd9af26be45c7a11cb5a7fc25aa929f1b994e994853ebeab548c8e2cd51afe368b88862e1e647c5336d66c8e3ad4bd11abccbfa59eb7ea3d76313c628751d2e4234d8161e95c1c3ccf79a75dbf574a8a826a1ad2e7c2b9c5fb47f782c8ebab3429dc9ccc764c271a6dd6d3648f717da79448ce68dd936a886d3135ab82d1edcf1d7915b71e256bcf7383ee9e944ab221544f7956e9c54f7d67867a11a19fb851764e6756331eddec29f3a577c45eac263895313165dc73e553945b39f7be85bdf76f3e5dd4d39eff88cff6cfc25f3842e678386bf38d3586ef98454b9691a2acbff592b82d694d6f48e8713b2775f6e48a9b6e725117af47dab9f781d6463114b6f2ed4572d749f338e78efcb4d65db818264eb15458e3b7f311ee1ea9ed3d75371253322b95225f119a5641ea2511f61cb8dc933efbf73877d91aeb527827f22cfa39423ffc36c81a4b8b335256b18432f8c3deaed59497641d7278eaeabc3ecf4a3b2d9bbf7b9f6138aa5eb81cb2c5c3ca3a4fc8f1bf86bdd798dd47e573fb5684b3da78849dd25aebb312bf89bcfae39693b26bb3afaf4696e46cc124a27f4d9121d94cf6c3269e73b876d3af99f74c3ad166a3ae99fb5e8c7fd95a4cdae5ca473b5eb95898876a5c49e4596adf1377d85f26c7ced2cb5fd63dc7917a6266c5d1242fc4138879c9a43481ceaeb83cd971d4ea99c1e4f2af8e87655b';\r\nb='81ee554651855edeb946e9d955f168cf41e27d95e34c85362341f8adab6de5bd6e23f4ca323a1c52cfa78b856f275dc2b85288ebba6919d3a449ae47b83dca94394fb62fa96ec4e3a1ac4dc4ac935281713be4d8fc8222d4cf6bf5e1617524c28688582528fb47e235a7eecd3f3a673b9d1e77d1bc3efe4377cea6a99bab57895ab9232d6cb4ceb59df1d6b7a47bb79ba9fcbedf46735cf7a61a885bde61695edf29e122dbf275ec8f2bdac75feea724d4eb2cc96a4ae6ee196c7ab1b42beadf1611875415351837ced343b7c8445623157385f8994993c1566211148a94cacfdcdbdcbbfb952a9327898f25b7351de857265da417c7dccbe5c3bd3ae9dfc17b7c4c8238a25e9e14527cb1d78b76191a85debbe2a28fe5d3c9cbd259bb369ecedd66729c1ce445c39f5d9ce5dc35a22b3ae8c5b98117bd541f678962582d2af496cfc916fad68d311ca59f9f398a48993114639f753cb7c319c72e294894f914ef9cc222164f24e8ee72e4e624f52b6e2bccf265d2e427d11eebf6bbaa7df1d2c7dc936c9a1da8b79d493585ce9156af84299584de2ea341f368865d14823d7ea681366ef98b7f3a7825741c4da539b84ce9527757955e151d1851c11ef528e4e81db782972a5f919164bac88eb46182f7d3aeeae2976791e656168674cb177c72eac3725ea2398257d72d249e6e92ba2d2cea398adbaf877627aba5c9dbc7b9438fd1b2b456c143f73b44d2a156c6b42fa469bca62944139aee1f645b3e2594b55213a8727f86595dda597fa5ed387f7193283c81f711ec853d9716869ab55e6468b9a6964253f85f14ac7fd135279c4417c373c891ce4797b8f477789c81ad3a7b439c13fc84a8de75b28c9be951e7be98f969e2a95268af13243314b312d81883d6bf13ffd7d594fe298392c336652112b6734a7f982cbd7d68429423f8d9aa245d7347d3b2fa123248488a796b1e6bc789715fee5d554e2aabae38361ef5e28d27679e17eb6e8a715c3a64733d976832c54ad12ebfb3b7bad524dab2bf9a1bb7324535f58d8abfa8f79cd4831d67f24c4d651fdafcfe929461b2aaa8ad616b2829b352ff636d384b3682c567d2494281824f45129ff55c1ac81e63d8a387db3d234b8464677fc561b8da4b1e1a313b6d5b978b8aa97ddfd6943759dc83c29ff17292ea9e9ca23842e1528cbeda638f6a6b84f8312bf35a6cee9b46cb3f1b3113c8e7925f5624a8c96696c5b3e9fb1af42c55681318753332668ef6a15d54697c76ba1e48978bb25b54146e1d727a9f51a7918e32c5934eeaff8dd5ab798ef64c1db8f64cb1ba756e9d41eb886f36be399f71de1dd8bc877ff4c4d96fcbf739f6a33825669475dbfa812a3ca5a319879bd951d43af8cf326a6f414bf2e721eaa8e9ff18a5ca7c5f91bab2394d35e5ab8516433c169f9d5bf3c7823b19838419c7ec8d25cdc31fcb95255b11de1f7d15a75dc7f31a581661452cabcee8be994f5e183d4bfa77588cb9789c6bf3cc6d83551a43a1ee7c2a2a6ef13dc18db8b32265fa919d7b5bde776ec79ecb2956899664a595dff62cf31d35fe4df14887eededf531e141a7d95bfe6dbee594e8e186ff9bfc366492747ac213b1d346e66472f3789186f4278d432797e2338dd861f3c289fb916f3f1d3abb7945a1c4594c325eb9ca5dc823d16446e5f86131c6d6e36551cdcfe16acacc6537c6de542e5a568c4d75deaacf6991f8b67b59f6e324c978ac729b491983747618c9e114dcad7744366d27923d82dda48e21bd351aefacc2b6dedfab6133dfbca92c183d48ad8943d6277988cab862b2caf5b851a4fb5678f329ca14c3c966a5c7b65ec49c1cc54caa623965163da2b387e5ba47bd33f1c1db86354132a225a9e1eea95d6a6cf436bc4b27a9a4a893ef638747cf1b6e53c64d119fb77ab87b8d9a66c6bbaf3bcab88eeb6f444dbb66891723144739564e38796ca759341376a4264e26d65b7f3b87aaece9f9137669e59511a7947aa1af7a8fc3ccb96b4457253f847864a7f635ecb429b4922d53fc225fefb373c27c2c35de659c24c8dde9324e8a94942ee7e3f41e2b151158ef8a36c2c246fc5e5eb7b41895d6cea95b5c232d52f8bedf71b587a28338a92f43bfb65d2e6fe3fadd4f51137b782417d957ea466ea3ea4c88114242efa7d5442613745b28ecdaa4bd2725823255e87487c773a8e5c458d3947c7cf97ce4d2c79aa3b2dcd1d4ead767cad2f3873fce289295f9e4ff598f4cea2a5aebd738ff341331419bd176398926613f9a4ce67847eaf5e46d65f823f48a676d7f98f6d9925b76f11868eb4fe4663c17fb357b1712a662b73a26542935b762c142e4739461e31c48463254cbd';\r\nr=multiply(a,b);\r\nfor k=1:20\r\n    r=multiply(r,b);\r\n    r=r(1:1000);\r\n    R(k)=hex2dec(r(100:110));\r\nend\r\nassert(isequal(round(mean(R)),8462291571351))\r\nassert(isequal(R(end),13300168684973))\r\n%%\r\nfiletext = fileread('multiply.m');\r\nnot_allowed = contains(filetext, 'persistent') || contains(filetext, 'global') || contains(filetext, 'BigInteger') || contains(filetext, 'java') || contains(filetext, 'py'); \r\nassert(~not_allowed)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-12-14T16:14:40.000Z","updated_at":"2021-12-14T16:14:40.000Z","published_at":"2021-12-14T16:14:40.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\u003eMultiply two large hexadecimal numbers together and output the hexadecimal representation of the result.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[a='abcdef123456789';\\nb='987654321fedcba';\\nr=multiply(a,b)\\nr =\\n\\n    '6651af60378fa86ce04c93a854f58a']]\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":2433,"title":"Consecutive Equation Times (of the day)","description":"Many times throughout the day can represent mathematical equations. In this problem, we focus on the largest consecutive run of equation times that include one of the four basic operations (+,-,*,/) or the power operator (^). Find the largest such consecutive run for a given range of input times (based on three-digit 12-hour times, 1:00 to 9:59). Return the first time stamp (string) and the number of consecutive points (integer, inclusive) for the maximum run (the first run if there is a tie).\r\n\r\nFor example, in the 2:07 to 2:29 time range, the answer is ['2:11' 3] since 2:10 has no equation, 2/1=1 (2:11), 2*1=2 (2:12), 2+1=3 (2:13) and 2:14 has no equation, and there are no such runs of four in that range.\r\n\r\nThis problem is related to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day Problem 2431\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2432-equation-times-of-the-day  Problem 2432\u003e.","description_html":"\u003cp\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on the largest consecutive run of equation times that include one of the four basic operations (+,-,*,/) or the power operator (^). Find the largest such consecutive run for a given range of input times (based on three-digit 12-hour times, 1:00 to 9:59). Return the first time stamp (string) and the number of consecutive points (integer, inclusive) for the maximum run (the first run if there is a tie).\u003c/p\u003e\u003cp\u003eFor example, in the 2:07 to 2:29 time range, the answer is ['2:11' 3] since 2:10 has no equation, 2/1=1 (2:11), 2*1=2 (2:12), 2+1=3 (2:13) and 2:14 has no equation, and there are no such runs of four in that range.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day\"\u003eProblem 2431\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2432-equation-times-of-the-day\"\u003eProblem 2432\u003c/a\u003e.\u003c/p\u003e","function_template":"function [t_s,num] = equation_times_run(times)\r\n t_s = '0:00';\r\n num = 0;\r\nend","test_suite":"%%\r\ntimes = {'1:00' '1:59'};\r\ny_correct = ['1:00' 24];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'2:07' '2:29'};\r\ny_correct = ['2:11' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'3:03' '4:04'};\r\ny_correct = ['3:11' 4];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'5:55' '7:11'};\r\ny_correct = ['6:15' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'7:17' '9:00'};\r\ny_correct = ['8:17' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'5:55' '9:00'};\r\ny_correct = ['6:15' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'1:00' '9:59'};\r\ny_correct = ['1:00' 24];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":66,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":45,"created_at":"2014-07-15T19:39:50.000Z","updated_at":"2026-01-15T14:27:21.000Z","published_at":"2014-07-15T19:39:50.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\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on the largest consecutive run of equation times that include one of the four basic operations (+,-,*,/) or the power operator (^). Find the largest such consecutive run for a given range of input times (based on three-digit 12-hour times, 1:00 to 9:59). Return the first time stamp (string) and the number of consecutive points (integer, inclusive) for the maximum run (the first run if there is a tie).\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\u003eFor example, in the 2:07 to 2:29 time range, the answer is ['2:11' 3] since 2:10 has no equation, 2/1=1 (2:11), 2*1=2 (2:12), 2+1=3 (2:13) and 2:14 has no equation, and there are no such runs of four in that range.\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 problem is related to\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/2431-power-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2431\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/2432-equation-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2432\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\"},{\"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":44427,"title":"what's my tax amount this year ?","description":"given an annual salary x and a tax rate i calculate the amount that you have to pay.Example\r\n\r\n  x = 70000;\r\n  i=.10\r\n  y_correct =7000","description_html":"\u003cp\u003egiven an annual salary x and a tax rate i calculate the amount that you have to pay.Example\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = 70000;\r\ni=.10\r\ny_correct =7000\r\n\u003c/pre\u003e","function_template":"function tax = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%test 1\r\nx = 70000;\r\ni=.10;\r\ny_correct =7000\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n%%test 2\r\nx = 80000;\r\ni=.15;\r\ny_correct =12000;\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n%%test 3\r\nx = 90000;\r\ni=.20;\r\ny_correct = 18000\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n%%test 4\r\nx = 100000;\r\ni=.30;\r\ny_correct = 30000\r\nassert(isequal(your_fcn_name(x,i),y_correct))\r\n","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":83,"test_suite_updated_at":"2017-12-02T15:09:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T15:06:30.000Z","updated_at":"2026-02-13T15:25:40.000Z","published_at":"2017-12-02T15:06: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\u003egiven an annual salary x and a tax rate i calculate the amount that you have to pay.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 = 70000;\\ni=.10\\ny_correct =7000]]\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":44330,"title":"Matrix element wise multiplication","description":"Take two incoming vectors, and multiply them element wise","description_html":"\u003cp\u003eTake two incoming vectors, and multiply them element wise\u003c/p\u003e","function_template":"function y = your_fcn_name(x,x1)\r\n  y = ...;\r\nend","test_suite":"%%\r\nx = [1 2; 3 4]; x1 = [4 3; 2 1];\r\ny_correct = [     4     6;     6     4];\r\nassert(isequal(your_fcn_name(x, x1),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":12852,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":115,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-14T17:37:43.000Z","updated_at":"2026-02-11T18:40:44.000Z","published_at":"2017-09-14T17:37: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\",\"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\u003eTake two incoming vectors, and multiply them element wise\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":46908,"title":"Product of elements in a column","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: 81px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 40.5px; transform-origin: 407px 40.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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eif x=[1 2 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 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e        3 4 5\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=\"\"\u003e        1 2 1] do the product of all the elements in a column such that your answer should be y=[3 16 15]\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;3 4 5;1 2 1];\r\ny_correct = [3 16 15];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx =[1 8 9 4;1 26 7 5];\r\ny_correct = [1 208 63 20];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx =[10 20;30 40];\r\ny_correct = [300 800];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx =[10 30;20 40];\r\ny_correct = [200 1200];\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":628208,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":"2020-10-23T09:06:17.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-18T10:24:59.000Z","updated_at":"2026-02-13T18:28:35.000Z","published_at":"2020-10-23T09:06: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\u003eif x=[1 2 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        3 4 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e        1 2 1] do the product of all the elements in a column such that your answer should be y=[3 16 15]\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":43618,"title":"Multiply two polynomials p and q given in in vector representation.","description":"Multiply two polynomials p and q given in vector representation.\r\nExample \r\np=[-2     0     1    -1     3     2]\r\n\r\nq=[1 0 -1 2 4]\r\n\r\nresult=[-2     0     3    -5    -6     5    -1     0    16     8]","description_html":"\u003cp\u003eMultiply two polynomials p and q given in vector representation.\r\nExample \r\np=[-2     0     1    -1     3     2]\u003c/p\u003e\u003cp\u003eq=[1 0 -1 2 4]\u003c/p\u003e\u003cp\u003eresult=[-2     0     3    -5    -6     5    -1     0    16     8]\u003c/p\u003e","function_template":"function y = MulPoly(p,q)\r\n  y = x;\r\nend","test_suite":"%%\r\np=[-2     0     1    -1     3     2]\r\nq=[1 0 -1 2 4]\r\ny_correct =[-2     0     3    -5    -6     5    -1     0    16     8];\r\nassert(isequal(MulPoly(p,q),y_correct))\r\n%%\r\np=[-2     0     1     0    -3     1]\r\nq=[-1     0    -1     2     2]\r\ny_correct =[2     0     1    -4    -2     1     5    -7    -4     2];\r\nassert(isequal(MulPoly(p,q),y_correct))\r\n%%\r\np=[1     2     0     5     0     3]\r\nq=[3     2     5     1     0     2]\r\ny_correct =[3     8     9    26    12    36    15    15    13     0     6];\r\nassert(isequal(MulPoly(p,q),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T23:09:36.000Z","updated_at":"2026-02-17T14:22:13.000Z","published_at":"2016-10-24T23:09:36.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\u003eMultiply two polynomials p and q given in vector representation. Example p=[-2 0 1 -1 3 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\u003eq=[1 0 -1 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\u003eresult=[-2 0 3 -5 -6 5 -1 0 16 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":61121,"title":"Multiplying the Sums of Two Arrays","description":"Get two arrays, add the values within the array up, and then multiply the two total values. \r\n[2,3]*[3,6]\r\n5*18\r\n90","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); 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: 111px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 408px 55.5px; transform-origin: 408px 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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=\"\"\u003eGet two arrays, add the values within the array up, and then multiply the two total 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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[2,3]*[3,6]\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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=\"\"\u003e5*18\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-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=\"\"\u003e90\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = multiplySums(x,h)\r\n  y = x*h\r\nend","test_suite":"%%\r\nx = [1,2];\r\nh = [3,1];\r\ny_correct = 12;\r\nassert(isequal(multiplySums(x,h),y_correct))\r\n%%\r\nx = [1,0];\r\nh = [0];\r\ny_correct = 0\r\nassert(isequal(multiplySums(x,h),y_correct))\r\n%%\r\nx = [0,0,100]\r\nh = [0,2,9];\r\ny_correct = 1100;\r\nassert(isequal(multiplySums(x,h),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":5018771,"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":"2025-12-09T01:26:14.000Z","updated_at":"2026-02-26T11:37:46.000Z","published_at":"2025-12-09T01:26:14.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\u003eGet two arrays, add the values within the array up, and then multiply the two total 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\u003e[2,3]*[3,6]\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\u003e5*18\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\u003e90\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":44699,"title":"Prime Product","description":"My professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj such that it is a prime number, where 1 \u003c= i \u003c j \u003c= N.\r\n\r\nIf it's possible to find any value of ai * aj such that it is a prime number, then print the smallest value of such ai * aj, otherwise print -1.\r\n\r\n  x=[1 2 3]\r\ny = 2\r\n\r\n\r\n  x=[5 5 5 2]\r\ny = -1\r\n","description_html":"\u003cp\u003eMy professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj such that it is a prime number, where 1 \u0026lt;= i \u0026lt; j \u0026lt;= N.\u003c/p\u003e\u003cp\u003eIf it's possible to find any value of ai * aj such that it is a prime number, then print the smallest value of such ai * aj, otherwise print -1.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex=[1 2 3]\r\ny = 2\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ex=[5 5 5 2]\r\ny = -1\r\n\u003c/pre\u003e","function_template":"function y = prime_product(x)\r\n  % my first problem I created\r\nend","test_suite":"%%\r\nx = [1 2 3];\r\ny_correct = 2;\r\nassert(isequal(prime_product(x),y_correct))\r\n\r\n%%\r\nx = [5 2 5 2];\r\ny_correct = -1;\r\nassert(isequal(prime_product(x),y_correct))\r\n\r\n%%\r\nx = [1 63];\r\ny_correct = -1;\r\nassert(isequal(prime_product(x),y_correct))\r\n\r\n%% \r\nx = [ 3 6 234 1 623 234 ];\r\ny_correct = 3;\r\nassert(isequal(prime_product(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":195572,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":34,"test_suite_updated_at":"2018-07-30T18:29:12.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-07-18T20:13:31.000Z","updated_at":"2025-12-09T15:21:32.000Z","published_at":"2018-07-18T20:40:31.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\u003eMy professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj such that it is a prime number, where 1 \u0026lt;= i \u0026lt; j \u0026lt;= N.\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\u003eIf it's possible to find any value of ai * aj such that it is a prime number, then print the smallest value of such ai * aj, otherwise print -1.\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]\\ny = 2\\n\\nx=[5 5 5 2]\\ny = -1]]\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":55515,"title":"Find the remainder - 01","description":"Given an array of integers, find the remainder when the product of all the elements is divided by 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: 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: 307.5px 8px; transform-origin: 307.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven an array of integers, find the remainder when the product of all the elements is divided by N\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = rem_mul(x,N)\r\n  y = x;\r\nend","test_suite":"%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13 ];\r\nN=3;\r\ny_correct = 1;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13 ];\r\nN=5;\r\ny_correct = 0;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13 ];\r\nN=19;\r\ny_correct = 7;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13, 1298323, 1264, 92188212, 9928381832, 12723812313 ];\r\nN=19;\r\ny_correct = 15;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124 ,134 ,23 ,49 ,235 ,13, 1298323, 1264, 92188212, 9928381832, 12723812313 ];\r\nN=199;\r\ny_correct = 8;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n\r\n%%\r\nx=[124999112 ,13414123356262 ,2312414 ,4912412 ,235124124 ,131298, 1298323, 1264, 92188212, 9928381832, 12723812313 ]\r\nN=1990;\r\ny_correct = 1036;\r\nassert(isequal(rem_mul(x,N),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":7,"created_by":363598,"edited_by":223089,"edited_at":"2022-10-14T07:04:51.000Z","deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2022-10-14T07:04:51.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-09-07T10:15:06.000Z","updated_at":"2025-11-29T16:40:34.000Z","published_at":"2022-09-07T10:23:25.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\u003eGiven an array of integers, find the remainder when the product of all the elements is divided by N\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":2230,"title":"Back to basics - array operations","description":"Without performing actual arithmetic operations on arrays, return feasibility of operation as true or false. True if given operation can be performed on given matrices, else false.\r\nExample\r\n Operation = 'Add'\r\n Matrices are:\r\n  a = magic(3);\r\n  b = [2 2; 2 2; 2 2]\r\nResult: false, since size of a and b should be same to perform \"Add\" operation.","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: 194.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 97.3667px; transform-origin: 407px 97.3667px; 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: 369.5px 8px; transform-origin: 369.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWithout performing actual arithmetic operations on arrays, return feasibility of operation as true or false. True if given operation can be performed on given matrices, else false.\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: 26.5px 8px; transform-origin: 26.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: 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: 52px 8.5px; transform-origin: 52px 8.5px; \"\u003e Operation = \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'Add'\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; perspective-origin: 40px 8.5px; transform-origin: 40px 8.5px; \"\u003e Matrices \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; \"\u003eare:\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: 60px 8.5px; tab-size: 4; transform-origin: 60px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e  a = magic(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: 84px 8.5px; tab-size: 4; 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  b = [2 2; 2 2; 2 2]\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: 247.5px 8px; transform-origin: 247.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eResult: false, since size of a and b should be same to perform \"Add\" operation.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = ArrayOperation(a,b,operation)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = magic(3);\r\ny = eye(3);\r\noperation = 'Add';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = magic(3);\r\ny = eye(2);\r\noperation = 'Add';\r\ny_correct = false;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = magic(3);\r\ny = repmat(3,3,3);\r\noperation = 'Multiply';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = magic(3);\r\ny = repmat(3,3,2);\r\noperation = 'Multiply';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Add';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Subtract';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = false;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(y,x,operation),y_correct))\r\n\r\n%%\r\nx = ones(3,2);\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = 3;\r\ny = ones(5,7);\r\noperation = 'Multiply';\r\ny_correct = true;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))\r\n\r\n%%\r\nx = ones(3,3);\r\ny = repmat(3,3,2);\r\noperation = 'Divide';\r\ny_correct = false;\r\nassert(isequal(ArrayOperation(x,y,operation),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":"2022-02-22T05:49:00.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-03-03T22:31:03.000Z","updated_at":"2025-12-04T17:14:15.000Z","published_at":"2014-03-03T22:33:40.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\u003eWithout performing actual arithmetic operations on arrays, return feasibility of operation as true or false. True if given operation can be performed on given matrices, else false.\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[ Operation = 'Add'\\n Matrices are:\\n  a = magic(3);\\n  b = [2 2; 2 2; 2 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eResult: false, since size of a and b should be same to perform \\\"Add\\\" operation.\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":2432,"title":"Equation Times (of the day)","description":"Many times throughout the day can represent mathematical equations. In this problem, we focus on times that include the four basic operations (+,-,*,/). For example, 6:17 can be written as 6=1+7. Write a function that determines if the given time (restricted to three digits in 12-hour time, 1:00 to 9:59) is an equation time, and if so, which basic operation it uses. There are also four types of equations that are categorized here, and a given time can fit more than one category:\r\n\r\n - equation written forward, \"=\" doesn't coincide with \":\" --\u003e add 1 to output (e.g., 2:35, 2+3=5)\r\n\r\n - equation written forward, \"=\" does coincide with \":\" -- \u003e add 100 to output (e.g., 2:53, 2=5-3)\r\n\r\n - equation written backward, \"=\" doesn't coincide with \":\" --\u003e add 10 to output (e.g., 3:26, 6=2*3)\r\n\r\n - equation written backward, \"=\" does coincide with \":\" --\u003e add 1000 to output (e.g., 4:28, 8/2=4)\r\n\r\nNote that some of these combinations are tied to each other due to the commutative nature of + and * and the inverse relation of +,- and **,/. The output should be a 4x2 matrix with 0s or 1s in the first column dependent on whether each operation (+,-,*,/) is applicable to a given time and the totals in the second column. Examples include: \r\n\r\n4:22 | out = [1 1100; 1 1; 1 1100; 1 1]; since 4=2+2, 2+2=4; 4-2=2; 4=2*2, 2*2=4; 4/2=2.\r\n\r\n5:15 | out = [0 0; 0 0; 1 1111; 1 1001]; since 5*1=5, 5=1*5, 5*1=5, 5=1*5; 5/1=5, 5/1=5.\r\n\r\nThis problem is related to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day Problem 2431\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2433-consecutive-equation-times-of-the-day Problem 2433\u003e.","description_html":"\u003cp\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on times that include the four basic operations (+,-,*,/). For example, 6:17 can be written as 6=1+7. Write a function that determines if the given time (restricted to three digits in 12-hour time, 1:00 to 9:59) is an equation time, and if so, which basic operation it uses. There are also four types of equations that are categorized here, and a given time can fit more than one category:\u003c/p\u003e\u003cpre\u003e - equation written forward, \"=\" doesn't coincide with \":\" --\u0026gt; add 1 to output (e.g., 2:35, 2+3=5)\u003c/pre\u003e\u003cpre\u003e - equation written forward, \"=\" does coincide with \":\" -- \u0026gt; add 100 to output (e.g., 2:53, 2=5-3)\u003c/pre\u003e\u003cpre\u003e - equation written backward, \"=\" doesn't coincide with \":\" --\u0026gt; add 10 to output (e.g., 3:26, 6=2*3)\u003c/pre\u003e\u003cpre\u003e - equation written backward, \"=\" does coincide with \":\" --\u0026gt; add 1000 to output (e.g., 4:28, 8/2=4)\u003c/pre\u003e\u003cp\u003eNote that some of these combinations are tied to each other due to the commutative nature of + and * and the inverse relation of +,- and ,/. The output should be a 4x2 matrix with 0s or 1s in the first column dependent on whether each operation (+,-,*,/) is applicable to a given time and the totals in the second column. Examples include:\u003c/p\u003e\u003cp\u003e4:22 | out = [1 1100; 1 1; 1 1100; 1 1]; since 4=2+2, 2+2=4; 4-2=2; 4=2*2, 2*2=4; 4/2=2.\u003c/p\u003e\u003cp\u003e5:15 | out = [0 0; 0 0; 1 1111; 1 1001]; since 5*1=5, 5=1*5, 5*1=5, 5=1*5; 5/1=5, 5/1=5.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day\"\u003eProblem 2431\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2433-consecutive-equation-times-of-the-day\"\u003eProblem 2433\u003c/a\u003e.\u003c/p\u003e","function_template":"function out = equation_time(time)\r\n out = 0;\r\nend","test_suite":"%%\r\ntime = '4:22';\r\ny_correct = [1 1100;\r\n\t1 1;\r\n\t1 1100;\r\n\t1 1];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '2:38';\r\ny_correct = zeros(4,2);\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '5:15';\r\ny_correct = [0 0;\r\n\t0 0;\r\n\t1 1111;\r\n \t1 1001];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '1:23';\r\ny_correct = [1 11;\r\n\t1 1000;\r\n\t0 0;\r\n \t0 0];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '1:02';\r\ny_correct = zeros(4,2);\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '1:11';\r\ny_correct = [0 0;\r\n\t0 0;\r\n\t1 1111;\r\n \t1 1111];\r\nassert(isequal(equation_time(time),y_correct))\r\n\r\n%%\r\ntime = '2:11';\r\ny_correct = [1 1100;\r\n\t1 1;\r\n\t0 0;\r\n \t0 0];\r\nassert(isequal(equation_time(time),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":79,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":45,"created_at":"2014-07-15T18:39:02.000Z","updated_at":"2026-01-15T14:29:10.000Z","published_at":"2014-07-15T18:39:02.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\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on times that include the four basic operations (+,-,*,/). For example, 6:17 can be written as 6=1+7. Write a function that determines if the given time (restricted to three digits in 12-hour time, 1:00 to 9:59) is an equation time, and if so, which basic operation it uses. There are also four types of equations that are categorized here, and a given time can fit more than one category:\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[ - equation written forward, \\\"=\\\" doesn't coincide with \\\":\\\" --\u003e add 1 to output (e.g., 2:35, 2+3=5)\\n\\n - equation written forward, \\\"=\\\" does coincide with \\\":\\\" -- \u003e add 100 to output (e.g., 2:53, 2=5-3)\\n\\n - equation written backward, \\\"=\\\" doesn't coincide with \\\":\\\" --\u003e add 10 to output (e.g., 3:26, 6=2*3)\\n\\n - equation written backward, \\\"=\\\" does coincide with \\\":\\\" --\u003e add 1000 to output (e.g., 4:28, 8/2=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\u003eNote that some of these combinations are tied to each other due to the commutative nature of + and * and the inverse relation of +,- and ,/. The output should be a 4x2 matrix with 0s or 1s in the first column dependent on whether each operation (+,-,*,/) is applicable to a given time and the totals in the second column. Examples include:\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\u003e4:22 | out = [1 1100; 1 1; 1 1100; 1 1]; since 4=2+2, 2+2=4; 4-2=2; 4=2*2, 2*2=4; 4/2=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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e5:15 | out = [0 0; 0 0; 1 1111; 1 1001]; since 5*1=5, 5=1*5, 5*1=5, 5=1*5; 5/1=5, 5/1=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\u003eThis problem is related to\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/2431-power-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2431\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/2433-consecutive-equation-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2433\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\"},{\"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":421,"title":"Multiply to the limit?","description":"If y = 4*x*x/pi/pi then what is the ultimate limiting result of (1+y/1/1)(1+y/3/3)(1+y/5/5)(1+y/7/7)... ... within 1000*eps?","description_html":"\u003cp\u003eIf y = 4*x*x/pi/pi then what is the ultimate limiting result of (1+y/1/1)(1+y/3/3)(1+y/5/5)(1+y/7/7)... ... within 1000*eps?\u003c/p\u003e","function_template":"function m = multiply(x)\r\n   y=4*x*x/pi/pi;\r\n   m=1; \r\n   for k=1:Inf\r\n      m=m*(1+y/(2*k-1)^2);\r\n   end\r\nend","test_suite":"%%\r\nx = 1.1;\r\nm = 1.6685185538222564;\r\nassert(abs(1-multiply(x)/m)\u003c1000*eps)\r\n%%\r\nx = pi;\r\nm = 11.591953275521519;\r\nassert(abs(1-multiply(x)/m)\u003c1000*eps)\r\n%%\r\nx = 1/pi;\r\nm = 1.0510897883672876;\r\nassert(abs(1-multiply(x)/m)\u003c1000*eps)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":5,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":40,"test_suite_updated_at":"2012-03-14T05:01:51.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-27T07:20:29.000Z","updated_at":"2025-12-07T16:44:36.000Z","published_at":"2012-03-14T20:15:14.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\u003eIf y = 4*x*x/pi/pi then what is the ultimate limiting result of (1+y/1/1)(1+y/3/3)(1+y/5/5)(1+y/7/7)... ... within 1000*eps?\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":42985,"title":"Vector multiplication","description":"Given two row vectors, v1 and v2, each representing an integer, such that the vector elements are the digits from left to right, return a row vector v3, of the same format, that represents the product of the integers represented by v1 and v2.\r\n\r\nExample 1:\r\n\r\nv1 = [1 2]\r\n\r\nv2 = [5 0 0]\r\n\r\nv3 = [6 0 0 0]\r\n\r\nExample 2:\r\n\r\nv1 = [9 9]\r\n\r\nv2 = [9 9]\r\n\r\nv3 = [9 8 0 1]","description_html":"\u003cp\u003eGiven two row vectors, v1 and v2, each representing an integer, such that the vector elements are the digits from left to right, return a row vector v3, of the same format, that represents the product of the integers represented by v1 and v2.\u003c/p\u003e\u003cp\u003eExample 1:\u003c/p\u003e\u003cp\u003ev1 = [1 2]\u003c/p\u003e\u003cp\u003ev2 = [5 0 0]\u003c/p\u003e\u003cp\u003ev3 = [6 0 0 0]\u003c/p\u003e\u003cp\u003eExample 2:\u003c/p\u003e\u003cp\u003ev1 = [9 9]\u003c/p\u003e\u003cp\u003ev2 = [9 9]\u003c/p\u003e\u003cp\u003ev3 = [9 8 0 1]\u003c/p\u003e","function_template":"function v3 = vmultiply(v1,v2)\r\n  v3 = v1*v2;\r\nend","test_suite":"%%\r\nfiletext = fileread('vmultiply.m');\r\nassert(isempty(strfind(filetext,'regexp')))\r\nassert(isempty(strfind(filetext,'switch')))\r\n\r\n%%\r\nv1 = [1 2];\r\nv2 = [5 0 0];\r\nv3_correct = [6 0 0 0];\r\nassert(isequal(vmultiply(v1,v2),v3_correct))\r\nassert(isequal(vmultiply(v2,v1),v3_correct))\r\n\r\n%%\r\nv1 = [9 9];\r\nv2 = [9 9];\r\nv3_correct = [9 8 0 1];\r\nassert(isequal(vmultiply(v1,v2),v3_correct))\r\nassert(isequal(vmultiply(v2,v1),v3_correct))\r\n\r\n%%\r\nv1 = [8 3 4 5 7 1 6 9 4 0 2 0 2 1 5 8 9 4];\r\nv2 = [1 0 0 6 6 9 4 3 1 8 2 7 0 5 4 5 5];\r\nv3_correct = [8 4 0 1 5 8 5 8 2 5 5 9 5 7 5 5 3 3 8 6 7 6 3 6 6 1 1 1 5 0 1 7 7 0];\r\nassert(isequal(vmultiply(v1,v2),v3_correct))\r\nassert(isequal(vmultiply(v2,v1),v3_correct))","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":33,"test_suite_updated_at":"2016-09-09T08:36:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-09-09T07:51:09.000Z","updated_at":"2025-12-05T13:02:52.000Z","published_at":"2016-09-09T07:51: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\u003eGiven two row vectors, v1 and v2, each representing an integer, such that the vector elements are the digits from left to right, return a row vector v3, of the same format, that represents the product of the integers represented by v1 and v2.\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 1:\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\u003ev1 = [1 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\u003ev2 = [5 0 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev3 = [6 0 0 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample 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\u003ev1 = [9 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev2 = [9 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ev3 = [9 8 0 1]\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":553,"title":"How to multiply?","description":"Imagine you are in 3012 Anno Domini, when everyone must learn how to multiply,\r\nand competing for the highly prestigious post of,\r\nChief Comptroller of Ylpitlum Corporation.\r\nYou are being tested via MATLAB Cody for multiplication of two positive integers X and Y,\r\nboth are fortunately in decimal system, and only a few dozen digits or less,\r\nand delivered as ASCII strings.\r\nPlease output the result Z in similar style.\r\nPlease adopt a general strategy, as X and Y may be changed later.\r\nPlease rename the function Z = ylpitlum(X,Y).\r\nFunction Template:\r\nfunction Z = ylpitlum(X,Y)\r\n   %  098765432109876543210987654321098765432109876543210987654321\r\n   X='170000000000000000000000000000';\r\n   Y='190000000000000000000000000000';\r\n   Z='32300000000000000000000000000000000000000000000000000000000';\r\nend","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: 346.933px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 173.467px; transform-origin: 407px 173.467px; vertical-align: baseline; \"\u003e\u003cul style=\"block-size: 204.333px; 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 102.167px; transform-origin: 391px 102.167px; 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: 254.5px 8px; transform-origin: 254.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eImagine you are in 3012 Anno Domini, when everyone must learn how to multiply,\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: 151.5px 8px; transform-origin: 151.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand competing for the highly prestigious post of,\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: 131px 8px; transform-origin: 131px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eChief Comptroller of Ylpitlum Corporation.\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: 76.5px 8px; transform-origin: 76.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eYou are being tested via\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"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=\"\"\u003eMATLAB Cody\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 154.5px 8px; transform-origin: 154.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for multiplication of two positive integers X and Y,\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: 233.5px 8px; transform-origin: 233.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\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: 96.5px 8px; transform-origin: 96.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eand delivered as ASCII strings.\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: 129px 8px; transform-origin: 129px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePlease output the result Z in similar style.\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: 210.5px 8px; transform-origin: 210.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePlease adopt a general strategy, as X and Y may be changed later.\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: 141.5px 8px; transform-origin: 141.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePlease rename the function Z = ylpitlum(X,Y).\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: 60px 8px; transform-origin: 60px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFunction Template:\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 122.6px; 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 61.3px; transform-origin: 404px 61.3px; 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: 104px 8.5px; tab-size: 4; transform-origin: 104px 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: 36px 8.5px; text-decoration: none; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); transform-origin: 36px 8.5px; \"\u003efunction \u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 68px 8.5px; transform-origin: 68px 8.5px; \"\u003eZ = ylpitlum(X,Y)\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: 264px 8.5px; tab-size: 4; transform-origin: 264px 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   \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: 252px 8.5px; text-decoration: none; text-decoration-color: rgb(2, 128, 9); text-emphasis-color: rgb(2, 128, 9); transform-origin: 252px 8.5px; \"\u003e%  098765432109876543210987654321098765432109876543210987654321\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: 152px 8.5px; tab-size: 4; transform-origin: 152px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e   X=\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: 128px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 128px 8.5px; \"\u003e'170000000000000000000000000000'\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: 152px 8.5px; tab-size: 4; transform-origin: 152px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e   Y=\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: 128px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 128px 8.5px; \"\u003e'190000000000000000000000000000'\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: 268px 8.5px; tab-size: 4; transform-origin: 268px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e   Z=\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: 244px 8.5px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 244px 8.5px; \"\u003e'32300000000000000000000000000000000000000000000000000000000'\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: 12px 8.5px; tab-size: 4; transform-origin: 12px 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); text-decoration: none; text-decoration-color: rgb(14, 0, 255); text-emphasis-color: rgb(14, 0, 255); \"\u003eend\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function Z = ylpitlum(X,Y)\r\n   %  098765432109876543210987654321098765432109876543210987654321\r\n   X='170000000000000000000000000000';\r\n   Y='190000000000000000000000000000';\r\n   Z='32300000000000000000000000000000000000000000000000000000000';\r\nend","test_suite":"%%\r\nX='170000000000000000000000000000';\r\nY='190000000000000000000000000000';\r\nZ='32300000000000000000000000000000000000000000000000000000000';\r\nassert(isequal(Z,ylpitlum(X,Y)))\r\n\r\n%%\r\nX='235711131719';\r\nY='232931374143475359';\r\nZ='54904517812220391149679812121';\r\nassert(isequal(Z,ylpitlum(X,Y)))\r\n\r\n%%\r\nX='7657534422342987897979879745232234';\r\nY='9878765654343431233130980808776767';\r\nZ='75646988048394475543709477144832189651639589891288011407029878707478';\r\nassert(isequal(Z,ylpitlum(X,Y)))\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":82,"test_suite_updated_at":"2021-11-28T17:15:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-04-03T06:24:52.000Z","updated_at":"2026-02-10T19:25:06.000Z","published_at":"2012-04-03T06:24:52.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=\\\"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\u003eImagine you are in 3012 Anno Domini, when everyone must learn how to multiply,\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\u003eand competing for the highly prestigious post of,\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\u003eChief Comptroller of Ylpitlum Corporation.\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\u003eYou are being tested via\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\u003eMATLAB Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for multiplication of two positive integers X and Y,\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\u003eboth are fortunately in decimal system, and only a few dozen digits or less,\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\u003eand delivered as ASCII strings.\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\u003ePlease output the result Z in similar style.\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\u003ePlease adopt a general strategy, as X and Y may be changed later.\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\u003ePlease rename the function Z = ylpitlum(X,Y).\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\u003eFunction Template:\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 Z = ylpitlum(X,Y)\\n   %  098765432109876543210987654321098765432109876543210987654321\\n   X='170000000000000000000000000000';\\n   Y='190000000000000000000000000000';\\n   Z='32300000000000000000000000000000000000000000000000000000000';\\nend]]\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":44262,"title":"Multivariate polynomials - overload multiplication","description":"Problems \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44260-multivariate-polynomials-convert-monomial-form-to-array 44260\u003e and \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44261-sort-multivariate-monomials 44261\u003e work with a monomial representation of multivariate polynomials. This has two parts, a matrix |exponents| with a row of exponents for each monomial, and a column vector |coefficients| with a coefficient for each monomial.\r\n\r\nIt would be nice to define polynomials so they can be multiplied using simple notation:\r\n\r\n  p = p1*p2;\r\n\r\nThis can be done by \u003chttps://www.mathworks.com/help/matlab/matlab_oop/user-defined-classes.html defining a class\u003e |mPoly| with two properties, |exponents| and |coefficients|, and two methods: a \u003chttps://www.mathworks.com/help/matlab/matlab_oop/class-constructor-methods.html constructor\u003e with the syntax\r\n\r\n  p = mPoly(exponents, coefficients)\r\n\r\nand a method \u003chttps://www.mathworks.com/help/matlab/ref/mtimes.html?searchHighlight=mtimes\u0026s_tid=doc_srchtitle mtimes\u003e for multiplying two polynomials. You can assume that the polynomials being multiplied have the same number of variables.\r\n","description_html":"\u003cp\u003eProblems \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44260-multivariate-polynomials-convert-monomial-form-to-array\"\u003e44260\u003c/a\u003e and \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44261-sort-multivariate-monomials\"\u003e44261\u003c/a\u003e work with a monomial representation of multivariate polynomials. This has two parts, a matrix \u003ctt\u003eexponents\u003c/tt\u003e with a row of exponents for each monomial, and a column vector \u003ctt\u003ecoefficients\u003c/tt\u003e with a coefficient for each monomial.\u003c/p\u003e\u003cp\u003eIt would be nice to define polynomials so they can be multiplied using simple notation:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ep = p1*p2;\r\n\u003c/pre\u003e\u003cp\u003eThis can be done by \u003ca href = \"https://www.mathworks.com/help/matlab/matlab_oop/user-defined-classes.html\"\u003edefining a class\u003c/a\u003e \u003ctt\u003emPoly\u003c/tt\u003e with two properties, \u003ctt\u003eexponents\u003c/tt\u003e and \u003ctt\u003ecoefficients\u003c/tt\u003e, and two methods: a \u003ca href = \"https://www.mathworks.com/help/matlab/matlab_oop/class-constructor-methods.html\"\u003econstructor\u003c/a\u003e with the syntax\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ep = mPoly(exponents, coefficients)\r\n\u003c/pre\u003e\u003cp\u003eand a method \u003ca href = \"https://www.mathworks.com/help/matlab/ref/mtimes.html?searchHighlight=mtimes\u0026s_tid=doc_srchtitle\"\u003emtimes\u003c/a\u003e for multiplying two polynomials. You can assume that the polynomials being multiplied have the same number of variables.\u003c/p\u003e","function_template":"classdef mPoly \r\n    %MPOLY Class of multivariate polynomials\r\n    \r\n    properties\r\n        exponents\r\n        coefficients\r\n    end\r\n    \r\n    methods\r\n        function p = mPoly(ex,co)\r\n        end\r\n        function p = mtimes(p1,p2)\r\n        end\r\n    end\r\n    \r\nend\r\n","test_suite":"%% Test polyMult\r\nfiletext = fileread('mPoly.m');\r\nassert(~contains(filetext,'regexp'))\r\n\r\n%% p1 = A, p2 = B\r\nc1 = randi(1000); c2 = randi(1000);\r\ne = 0;\r\np1 = mPoly(e,c1);\r\np2 = mPoly(e,c2);\r\np = p1*p2;\r\nassert(isequal(c1*c2,p.coefficients))\r\nassert(isequal(e,p.exponents))\r\n\r\n%% p1 = y-x^2, p2 = x-2\r\ne1 = [2 0; 0 1];\r\nc1 = [-1; 1];\r\ne2 = [1 0; 0 0];\r\nc2 = [1; -2];\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np = p1*p2;\r\n\r\n[e,idx] = unique(p.exponents,'rows');\r\nc = p.coefficients(idx);\r\nassert(isequal(e,[0 1; 1 1; 2 0; 3 0]))\r\nassert(isequal(c,[-2; 1; 2; -1]))\r\n\r\n%% p1 = y-x^2, p2 = z-2\r\ne1 = [0 1 0; 2 0 0];\r\nc1 = [1; -1];\r\ne2 = [0 0 1; 0 0 0];\r\nc2 = [1; -2];\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np = p1*p2;\r\n\r\n[e,idx] = unique(p.exponents,'rows');\r\nc = p.coefficients(idx);\r\nassert(isequal(e,[0 1 0; 0 1 1; 2 0 0; 2 0 1]))\r\nassert(isequal(c,[-2; 1; 2; -1]))\r\n\r\n\r\n%% p1 = z-x^3, p2 = x^2+y^2+z^2-1\r\ne1 = [0 0 1; 3 0 0];\r\nc1 = [1; -1];\r\ne2 = [2 0 0; 0 2 0; 0 0 2; 0 0 0];\r\nc2 = [1; 1; 1; -1];\r\n\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np = p1*p2;\r\n\r\n[e,idx] = unique(p.exponents,'rows');\r\nc = p.coefficients(idx);\r\nassert(isequal(e,[0 0 1; 0 0 3; 0 2 1; 2 0 1; 3 0 0; 3 0 2; 3 2 0; 5 0 0]))\r\nassert(isequal(c,[-1 1 1 1 1 -1 -1 -1]'))\r\n\r\n%% Commutative\r\nc1 = randi(1000,[2 1]);\r\ne1 = randi(1000,[2 2]);\r\nc2 = randi(1000,[3 1]);\r\ne2 = randi(1000,[3 2]);\r\np1 = mPoly(e1,c1);\r\np2 = mPoly(e2,c2);\r\np12 = p1*p2;\r\np21 = p2*p1;\r\n[e12,i12] = unique(p12.exponents,'rows');\r\n[e21,i21] = unique(p21.exponents,'rows');\r\nc12 = p12.coefficients(i12);\r\nc21 = p21.coefficients(i21);\r\nassert(isequal(e12,e21))\r\nassert(isequal(c12,c21))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":1011,"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":"2017-07-14T04:04:05.000Z","updated_at":"2025-12-22T13:16:38.000Z","published_at":"2017-07-14T04:04:05.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\u003eProblems\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-multivariate-polynomials-convert-monomial-form-to-array\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44260\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44261-sort-multivariate-monomials\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e44261\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e work with a monomial representation of multivariate polynomials. This has two parts, a matrix\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\u003eexponents\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with a row of exponents for each monomial, and a column vector\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\u003ecoefficients\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with a coefficient for each 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\u003eIt would be nice to define polynomials so they can be multiplied using simple notation:\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 = p1*p2;]]\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 can be done by\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/help/matlab/matlab_oop/user-defined-classes.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edefining a class\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:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emPoly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with two properties,\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\u003eexponents\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\u003ecoefficients\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and two methods: a\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/help/matlab/matlab_oop/class-constructor-methods.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003econstructor\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e with the syntax\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 = mPoly(exponents, coefficients)]]\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\u003eand a method\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/help/matlab/ref/mtimes.html?searchHighlight=mtimes\u0026amp;s_tid=doc_srchtitle\\\"\u003e\u003cw:r\u003e\u003cw:t\u003emtimes\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for multiplying two polynomials. You can assume that the polynomials being multiplied have the same number of variables.\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":44263,"title":"Multivariate polynomials - emulate symbolic form","description":"In \u003chttps://www.mathworks.com/matlabcentral/cody/problems/44262-multivariate-polynomials-overload-multiplication Problem 44262\u003e I asked you to create a class |mPoly| with overloaded multiplication, so a product of two polynomials can be expressed in the form |p = p1*p2|. However, the method of constructing these polynomials is still somewhat unintuitive. In the \u003chttps://www.mathworks.com/products/symbolic.html Symbolic Math Toolbox\u003e, one can simply define some variables,\r\n\r\n  syms x y z\r\n\r\nand then create a polynomial:\r\n\r\n  p = 2*x*y + 3*x^5*z;\r\n\r\nWe would like to do something like that here. As a start, create a class |mPolySym| with properties |exponents| and |coefficients|, and |varnames|,  where the first two properties are the same as in previous problems and |varnames| is a \u003chttps://www.mathworks.com/help/matlab/characters-and-strings.html string array\u003e. The constructor should accept a numeric, char or string input, e.g.,\r\n\r\n  x = mPolySym('x')\r\n\r\n  x = \r\n\r\n  mPolySym with properties:\r\n\r\n        varnames: \"x\"\r\n       exponents: 1\r\n    coefficients: 1\r\n\r\n  r = mPolySym(pi)\r\n\r\n  r = \r\n\r\n  mPolySym with properties:\r\n\r\n        varnames: [0×0 string]\r\n       exponents: 1\r\n    coefficients: 3.1416\r\n\r\nAlso modify the method |mtimes| from the previous problem so it can multiply polynomials with different variable names.","description_html":"\u003cp\u003eIn \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/44262-multivariate-polynomials-overload-multiplication\"\u003eProblem 44262\u003c/a\u003e I asked you to create a class \u003ctt\u003emPoly\u003c/tt\u003e with overloaded multiplication, so a product of two polynomials can be expressed in the form \u003ctt\u003ep = p1*p2\u003c/tt\u003e. However, the method of constructing these polynomials is still somewhat unintuitive. In the \u003ca href = \"https://www.mathworks.com/products/symbolic.html\"\u003eSymbolic Math Toolbox\u003c/a\u003e, one can simply define some variables,\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003esyms x y z\r\n\u003c/pre\u003e\u003cp\u003eand then create a polynomial:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ep = 2*x*y + 3*x^5*z;\r\n\u003c/pre\u003e\u003cp\u003eWe would like to do something like that here. As a start, create a class \u003ctt\u003emPolySym\u003c/tt\u003e with properties \u003ctt\u003eexponents\u003c/tt\u003e and \u003ctt\u003ecoefficients\u003c/tt\u003e, and \u003ctt\u003evarnames\u003c/tt\u003e,  where the first two properties are the same as in previous problems and \u003ctt\u003evarnames\u003c/tt\u003e is a \u003ca href = \"https://www.mathworks.com/help/matlab/characters-and-strings.html\"\u003estring array\u003c/a\u003e. The constructor should accept a numeric, char or string input, e.g.,\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ex = mPolySym('x')\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ex = \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003emPolySym with properties:\r\n\u003c/pre\u003e\u003cpre\u003e        varnames: \"x\"\r\n       exponents: 1\r\n    coefficients: 1\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003er = mPolySym(pi)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003er = \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003emPolySym with properties:\r\n\u003c/pre\u003e\u003cpre\u003e        varnames: [0×0 string]\r\n       exponents: 1\r\n    coefficients: 3.1416\u003c/pre\u003e\u003cp\u003eAlso modify the method \u003ctt\u003emtimes\u003c/tt\u003e from the previous problem so it can multiply polynomials with different variable names.\u003c/p\u003e","function_template":"classdef mPolySym\r\n    properties\r\n        varnames\r\n        exponents\r\n        coefficients\r\n    end\r\n    \r\n    methods\r\n        function p = mPolySym(s)\r\n        end\r\n        \r\n        function p = mtimes(p1,p2)\r\n        end            \r\n    end\r\n    \r\nend\r\n\r\n","test_suite":"%% Test mPolySym\r\nfiletext = fileread('mPolySym.m');\r\nassert(~contains(filetext,'regexp'))\r\n\r\n\r\n%%\r\nr = randi(1000);\r\nx = mPolySym(r);\r\nassert(isempty(x.varnames))\r\nassert(isequal(x.exponents,0))\r\nassert(isequal(x.coefficients,r))\r\n\r\n%%\r\nr = randi(1000);\r\nx = mPolySym('x');\r\ny = r*x;\r\nassert(isequal(y.varnames,\"x\"))\r\nassert(isequal(y.exponents,1))\r\nassert(isequal(y.coefficients,r))\r\nassert(isequal(r*x,x*r))\r\n\r\n%%\r\nx = mPolySym('x');\r\ny = mPolySym(\"y\");\r\nz = mPolySym('z');\r\nw = x*y*z;\r\nassert(isequal(w.varnames,[\"x\" \"y\" \"z\"]))\r\nassert(isequal(w.exponents,[1 1 1]))\r\nassert(isequal(w.coefficients,1))\r\n\r\n%%\r\nm = randi(5);\r\nn = randi(4);\r\nx = mPolySym(\"x\");\r\ny = mPolySym(\"y\");\r\np = [repmat(x,1,m) repmat(y,1,n)];\r\np = p(randperm(length(p)));\r\nr = randi(1000);\r\np_prod = r;\r\nfor ii=1:length(p)\r\n    p_prod = p_prod*p(ii);\r\nend\r\ns = randi(1000);\r\np_prod = p_prod*s;\r\nassert(isequal(p_prod.varnames,[\"x\" \"y\"]))\r\nassert(isequal(p_prod.exponents,[m n]))\r\nassert(isequal(p_prod.coefficients,r*s))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":1011,"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":"2017-07-14T23:13:17.000Z","updated_at":"2025-12-22T13:23:36.000Z","published_at":"2017-07-14T23:13:34.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/44262-multivariate-polynomials-overload-multiplication\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 44262\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e I asked you to create a class\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\u003emPoly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with overloaded multiplication, so a product of two polynomials can be expressed in the form\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 = p1*p2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. However, the method of constructing these polynomials is still somewhat unintuitive. In 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=\\\"https://www.mathworks.com/products/symbolic.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSymbolic Math Toolbox\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, one can simply define some variables,\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[syms x y z]]\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\u003eand then create a polynomial:\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 = 2*x*y + 3*x^5*z;]]\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\u003eWe would like to do something like that here. As a start, create a class\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\u003emPolySym\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e with properties\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\u003eexponents\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\u003ecoefficients\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\u003evarnames\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, where the first two properties are the same as in previous problems 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\u003evarnames\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a\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/help/matlab/characters-and-strings.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estring array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. The constructor should accept a numeric, char or string input, 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 = mPolySym('x')\\n\\nx = \\n\\nmPolySym with properties:\\n\\n        varnames: \\\"x\\\"\\n       exponents: 1\\n    coefficients: 1\\n\\nr = mPolySym(pi)\\n\\nr = \\n\\nmPolySym with properties:\\n\\n        varnames: [0×0 string]\\n       exponents: 1\\n    coefficients: 3.1416]]\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\u003eAlso modify the method\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\u003emtimes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e from the previous problem so it can multiply polynomials with different variable names.\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":53705,"title":"Multiply Large Hexadecimal Numbers ","description":"Multiply two large hexadecimal numbers together and output the hexadecimal representation of the result.\r\nFor example:\r\na='abcdef123456789';\r\nb='987654321fedcba';\r\nr=multiply(a,b)\r\nr =\r\n\r\n    '6651af60378fa86ce04c93a854f58a'","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: 183.625px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 91.8125px; transform-origin: 407px 91.8125px; 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eMultiply two large hexadecimal numbers together and output the hexadecimal representation of the result.\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=\"\"\u003eFor example:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 122.625px; 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 61.3125px; transform-origin: 404px 61.3125px; 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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ea=\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); \"\u003e'abcdef123456789'\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eb=\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); \"\u003e'987654321fedcba'\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003er=multiply(a,b)\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003er =\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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; 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.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: 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.2188px; transform-origin: 404px 10.2188px; 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 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\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); \"\u003e'6651af60378fa86ce04c93a854f58a'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = multiply(a,b)\r\n  y = a*b;\r\nend","test_suite":"%%\r\na='abcdef123456789';\r\nb='987654321fedcba';\r\nr_correct='6651af60378fa86ce04c93a854f58a';\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='abcdef123456789987654321123456789987654321abcabcefef987654321';\r\nb='987654321fedcbaabcdef123456789987654321fedcba';\r\nr_correct='6651af60378fa879c1e46f2d0a75920a109ee4df46b8d28d4a5570241a4a083fea6f165773615145bebeb95db05fefac6a410121fa';\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='abcdef123456789987654321123456789987654321abcabcefef987654321987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba';\r\nb='987654321fedcbaabcdef123456789987654321fedcbaabcdef123456789987654321123456789987654321abcabcefef987654321987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcbaabcdef123456789987654321123456789987654321abcabcefef987654321987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba987654321fedcbaabcdef123456789987654321fedcba';\r\nr_correct='6651af60378fa879c1e46f2d0a75920a109ee4df46b8d9c2168621697fb3ffb9a6014131ea0389ad6a4250890b58ccd1a4c35a906ecb65e1f3b97bd284d991e57c42e0a21a8d890fae70dba6e105ae662d64ebc602da3c920cd937e65f652252d4da9f54a95bb71db0e6f5074e34385cfdc4df910f042e70ed5e5a608146f508289e0f89f4fec680b592bcbe32f9430c76a2b471c0f01e1ebaa30a677bd251d2c688c230b7743079f60cf128fb9b3944d757f0b3c984c6145a131dab1ecbe15fec936f7e3c380d263c6e7419d63127e19c767c1f95299175d6a55fcb3058805f253f488d2fd4aa53f500226a193445700dedb325c907079054a6fc67fbef8803cbfc7ed80e762e7fb83f45098d2a245b3fd6969cc51b1c6c52154b018a6c97ee985ad58a9a29cf3c56f5e2bdd8a42ef14bb9ffd0539a5ea9c1b4ccf7eea7b4481f929ff8198c142c3e6f9ddb5d3cdd610f04d405ba320e0f96265f029139cdce2367d148f1ea6d13a2920f91f9a26024d3c6c6130d7b54cf1ecbe15fec936f7e3c380d263c6e7419d63127e19c7674eac8f8e030713b6dfe40712981ba9a80e8e2fcb8cb5d3394418c5bd56a10b726ee40651b281647053f5eadcaa51a7ec08e351f4c9224d43d54d8bbdcfcd6a827faca761b16ef5c8600552d8d73996a35fc538953cfc5a0ab841e485f2b028aeb591f899eeff1e6ce942da3508c1aa60dadf4f603cb5d15f663c0449406dd7efc609a4be2a93d97763f9576e0b765acee69a28ef4e14b5e6ff8f03a81a540d2fcab10b9d6bf3a0cefbdd7beaa6f6d64d224a6f710a41fffeb3683724';\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='b828e27fb98e8eb3c9dbad17cafc174fa5bec23c5a9b81f4ad16ea69726681312426326f418a553655c7f76de813a19f823cce2e4bd59538172c449972bfb324a9eaea441dd6d357417d7137fc4524e4be7e4abf11c36dac6a4cfc64993ce9bbb589149b7b8cb5d4b52a1685dc7b9825dde3c5e2e2e393a47d9cfc6386c58b9d5613ab9394ca3b295fc7759842a7c41479a16a67d83269fbd2d6182e56c9e869ae19fcea7e2f756f2358827341d17bf21c18f632d8518e9ea8f354385b81a512263e566f8ffab7dfb53476af4f46e93fd7dd7'\r\nb='f73722dfd9c5dcdfd728baf831676461cb388df9a49d5153262be72744bc2e819b76c22db8a1a7d8cafc77f9b429e2c5df38e4c4c1c3589b9cfe9285e414563cac3992e9e43a5949a1b751d6839b3537df82bf217646a7abfa48e8312513849cb639eb91835d5c34d7ae144d13de445617e8a2282be4e44e2e4ee9ce6fe9c44246559d486b9afdf39e66ce6ef535ff3e28d71c29bdc9867ed111ccc998273281748f5b72bb65bd645691b1247ab69aad27fce262fc7aa28b3fe464eb329a856d233a8687979c25dbd6aa334ceb78b79867ba9f5f38d188e1d166ba528c3b11cad21c3ec1fafd65261767ad7c925c56c7ec284a6428eb7a7655855a5724d39976db2b95b4de8d7de1f4e8b61d4dba8dc16ae7be5a1c88ef73ff14f56c71d34a35dbb1bc3e349228182cc285ffa86182c5fe118f9d1431ef97b9349de9a1534b417b38a1bcaa57452b165e96b11112cb59959757a4391ff7b776e88fa5a5b9af93aad983aa96dd27573455f36e3144866c1633f2efff756792bc2b7bae32f39c536a3ec65534946693d6ae86c4f986c8b48f4d73d3f7a44ed75271a1552e8231aec26fccf'\r\nr_correct='b1d71c685bd4ab906c23d7206d1747e1abac54768849561a9cf0c34d464a758a8c3d5c0fa7b4ee5472aab583b934f111f0e419637c894323424c45c74892e9c5a3566dead652f0147cfe09687dbf835a3125439197562f6e684f8e73842c6bd6fbc1ac7225db2179f334c318c4815d5ce395df374a74ac0cf259113e31beabe2f80fff2c8a1d2f472c4f36af26427ebd2e0cd5d92e88d9bfc952579544aef0907e19d3a8224677b9ab2558450713d49029cd180da291febb957d1e96829ef4e82e2ad4e5ec1e3e291c709d17ee6e12fde69be843ba9e05951182dbb80990ccb356221f2039c9487ce02bf8aa9d9fcf0be867c3ad904f029cab6b524d1136cbae33b3a57f92026a7490fe6f7453725ef7913d60e683fe3e9e53b6e44cdc8a0395675e3de4d451226ce17940b5391cf43122d7a74a2e34d4daafac7bddaa7c141dbff7a1b3dafe9a7cde0acc7657fea0ad14ff0dfc4dde3f2c4db49a84ff11c663f19068a84f1d7a454e5a2aad5f6639f4393bec19777232537651ffdd4a77c25b88188479ebe9bcc92ed0a2c608a638e6be157907a076c87f3e142b47074f385529c842ee53d35ccc1fbac357b90c81d2dda0358a52bcaf65cd7e57dc3d4768f6907bb645f25e72592c198b35b5ddc03a4ba02f57ca5d2113fb54b242b5506c8ccc0bb98100b4cf0c09d42f63ac4377e9bca67896486ef7e7de6d2364cd71ace868bc9642e165ecb5394ba2bd8e0d09f83bd7c00f9e4b1ba458a95361f18eae88ec0ef41d78c901ab04ae259e9b6e9db1e7c8f28835ed6eb9c3f3699778d57358f2e62fe2a6d5361ae5a74b1fe3d95144e59bff95e9a0aacd23f241f2892c21615c466fccf7079177d73212a3bfdd6e51539013c264d9'\r\nassert(isequal(multiply(a,b),r_correct))\r\n%%\r\na='6cfe54496998b194774d118c8cab3586bb98347fccfca4c58286a275c9ab6b25d22af41a7b5afa4e427993ce51981c44c5715aeecfb1c2ce6b9b2a2dcf348667c656ea942efd5a69ed73f4fa19391d328e812595996ec66f7b8debfec112d3f5ea1936376a4d59e7615814e985df5372b856763e511872678c245d6b8968454e67fc65ea56f5b4c3d3852ae684fe3f2327f581d1a621dffafb871458924a42a85124f6b222f52a317b678742ad4f189c7245cc84f1a3171479764d1cda1e2e555c44f1e974ec53c8579d1132fddd57b9c6b273314b3b326c36b984bdd892e96645a94ce3cba982e9a1a2bcd5a2e88672b2992435a758f218aa7f452a83a2ade5eb2b617f6172f5d3ba9795f48d393118117249f61ce86d68fb9424e46366cc191a586befae3f26ef7412c29d7153483aa4bc1bba73a953ce824d3b733b9d9e3edb9195222472cb6164b793f22bdd9af26be45c7a11cb5a7fc25aa929f1b994e994853ebeab548c8e2cd51afe368b88862e1e647c5336d66c8e3ad4bd11abccbfa59eb7ea3d76313c628751d2e4234d8161e95c1c3ccf79a75dbf574a8a826a1ad2e7c2b9c5fb47f782c8ebab3429dc9ccc764c271a6dd6d3648f717da79448ce68dd936a886d3135ab82d1edcf1d7915b71e256bcf7383ee9e944ab221544f7956e9c54f7d67867a11a19fb851764e6756331eddec29f3a577c45eac263895313165dc73e553945b39f7be85bdf76f3e5dd4d39eff88cff6cfc25f3842e678386bf38d3586ef98454b9691a2acbff592b82d694d6f48e8713b2775f6e48a9b6e725117af47dab9f781d6463114b6f2ed4572d749f338e78efcb4d65db818264eb15458e3b7f311ee1ea9ed3d75371253322b95225f119a5641ea2511f61cb8dc933efbf73877d91aeb527827f22cfa39423ffc36c81a4b8b335256b18432f8c3deaed59497641d7278eaeabc3ecf4a3b2d9bbf7b9f6138aa5eb81cb2c5c3ca3a4fc8f1bf86bdd798dd47e573fb5684b3da78849dd25aebb312bf89bcfae39693b26bb3afaf4696e46cc124a27f4d9121d94cf6c3269e73b876d3af99f74c3ad166a3ae99fb5e8c7fd95a4cdae5ca473b5eb95898876a5c49e4596adf1377d85f26c7ced2cb5fd63dc7917a6266c5d1242fc4138879c9a43481ceaeb83cd971d4ea99c1e4f2af8e87655b';\r\nb='81ee554651855edeb946e9d955f168cf41e27d95e34c85362341f8adab6de5bd6e23f4ca323a1c52cfa78b856f275dc2b85288ebba6919d3a449ae47b83dca94394fb62fa96ec4e3a1ac4dc4ac935281713be4d8fc8222d4cf6bf5e1617524c28688582528fb47e235a7eecd3f3a673b9d1e77d1bc3efe4377cea6a99bab57895ab9232d6cb4ceb59df1d6b7a47bb79ba9fcbedf46735cf7a61a885bde61695edf29e122dbf275ec8f2bdac75feea724d4eb2cc96a4ae6ee196c7ab1b42beadf1611875415351837ced343b7c8445623157385f8994993c1566211148a94cacfdcdbdcbbfb952a9327898f25b7351de857265da417c7dccbe5c3bd3ae9dfc17b7c4c8238a25e9e14527cb1d78b76191a85debbe2a28fe5d3c9cbd259bb369ecedd66729c1ce445c39f5d9ce5dc35a22b3ae8c5b98117bd541f678962582d2af496cfc916fad68d311ca59f9f398a48993114639f753cb7c319c72e294894f914ef9cc222164f24e8ee72e4e624f52b6e2bccf265d2e427d11eebf6bbaa7df1d2c7dc936c9a1da8b79d493585ce9156af84299584de2ea341f368865d14823d7ea681366ef98b7f3a7825741c4da539b84ce9527757955e151d1851c11ef528e4e81db782972a5f919164bac88eb46182f7d3aeeae2976791e656168674cb177c72eac3725ea2398257d72d249e6e92ba2d2cea398adbaf877627aba5c9dbc7b9438fd1b2b456c143f73b44d2a156c6b42fa469bca62944139aee1f645b3e2594b55213a8727f86595dda597fa5ed387f7193283c81f711ec853d9716869ab55e6468b9a6964253f85f14ac7fd135279c4417c373c891ce4797b8f477789c81ad3a7b439c13fc84a8de75b28c9be951e7be98f969e2a95268af13243314b312d81883d6bf13ffd7d594fe298392c336652112b6734a7f982cbd7d68429423f8d9aa245d7347d3b2fa123248488a796b1e6bc789715fee5d554e2aabae38361ef5e28d27679e17eb6e8a715c3a64733d976832c54ad12ebfb3b7bad524dab2bf9a1bb7324535f58d8abfa8f79cd4831d67f24c4d651fdafcfe929461b2aaa8ad616b2829b352ff636d384b3682c567d2494281824f45129ff55c1ac81e63d8a387db3d234b8464677fc561b8da4b1e1a313b6d5b978b8aa97ddfd6943759dc83c29ff17292ea9e9ca23842e1528cbeda638f6a6b84f8312bf35a6cee9b46cb3f1b3113c8e7925f5624a8c96696c5b3e9fb1af42c55681318753332668ef6a15d54697c76ba1e48978bb25b54146e1d727a9f51a7918e32c5934eeaff8dd5ab798ef64c1db8f64cb1ba756e9d41eb886f36be399f71de1dd8bc877ff4c4d96fcbf739f6a33825669475dbfa812a3ca5a319879bd951d43af8cf326a6f414bf2e721eaa8e9ff18a5ca7c5f91bab2394d35e5ab8516433c169f9d5bf3c7823b19838419c7ec8d25cdc31fcb95255b11de1f7d15a75dc7f31a581661452cabcee8be994f5e183d4bfa77588cb9789c6bf3cc6d83551a43a1ee7c2a2a6ef13dc18db8b32265fa919d7b5bde776ec79ecb2956899664a595dff62cf31d35fe4df14887eededf531e141a7d95bfe6dbee594e8e186ff9bfc366492747ac213b1d346e66472f3789186f4278d432797e2338dd861f3c289fb916f3f1d3abb7945a1c4594c325eb9ca5dc823d16446e5f86131c6d6e36551cdcfe16acacc6537c6de542e5a568c4d75deaacf6991f8b67b59f6e324c978ac729b491983747618c9e114dcad7744366d27923d82dda48e21bd351aefacc2b6dedfab6133dfbca92c183d48ad8943d6277988cab862b2caf5b851a4fb5678f329ca14c3c966a5c7b65ec49c1cc54caa623965163da2b387e5ba47bd33f1c1db86354132a225a9e1eea95d6a6cf436bc4b27a9a4a893ef638747cf1b6e53c64d119fb77ab87b8d9a66c6bbaf3bcab88eeb6f444dbb66891723144739564e38796ca759341376a4264e26d65b7f3b87aaece9f9137669e59511a7947aa1af7a8fc3ccb96b4457253f847864a7f635ecb429b4922d53fc225fefb373c27c2c35de659c24c8dde9324e8a94942ee7e3f41e2b151158ef8a36c2c246fc5e5eb7b41895d6cea95b5c232d52f8bedf71b587a28338a92f43bfb65d2e6fe3fadd4f51137b782417d957ea466ea3ea4c88114242efa7d5442613745b28ecdaa4bd2725823255e87487c773a8e5c458d3947c7cf97ce4d2c79aa3b2dcd1d4ead767cad2f3873fce289295f9e4ff598f4cea2a5aebd738ff341331419bd176398926613f9a4ce67847eaf5e46d65f823f48a676d7f98f6d9925b76f11868eb4fe4663c17fb357b1712a662b73a26542935b762c142e4739461e31c48463254cbd';\r\nr=multiply(a,b);\r\nfor k=1:20\r\n    r=multiply(r,b);\r\n    r=r(1:1000);\r\n    R(k)=hex2dec(r(100:110));\r\nend\r\nassert(isequal(round(mean(R)),8462291571351))\r\nassert(isequal(R(end),13300168684973))\r\n%%\r\nfiletext = fileread('multiply.m');\r\nnot_allowed = contains(filetext, 'persistent') || contains(filetext, 'global') || contains(filetext, 'BigInteger') || contains(filetext, 'java') || contains(filetext, 'py'); \r\nassert(~not_allowed)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":145982,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-12-14T16:14:40.000Z","updated_at":"2021-12-14T16:14:40.000Z","published_at":"2021-12-14T16:14:40.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\u003eMultiply two large hexadecimal numbers together and output the hexadecimal representation of the result.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[a='abcdef123456789';\\nb='987654321fedcba';\\nr=multiply(a,b)\\nr =\\n\\n    '6651af60378fa86ce04c93a854f58a']]\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":2433,"title":"Consecutive Equation Times (of the day)","description":"Many times throughout the day can represent mathematical equations. In this problem, we focus on the largest consecutive run of equation times that include one of the four basic operations (+,-,*,/) or the power operator (^). Find the largest such consecutive run for a given range of input times (based on three-digit 12-hour times, 1:00 to 9:59). Return the first time stamp (string) and the number of consecutive points (integer, inclusive) for the maximum run (the first run if there is a tie).\r\n\r\nFor example, in the 2:07 to 2:29 time range, the answer is ['2:11' 3] since 2:10 has no equation, 2/1=1 (2:11), 2*1=2 (2:12), 2+1=3 (2:13) and 2:14 has no equation, and there are no such runs of four in that range.\r\n\r\nThis problem is related to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day Problem 2431\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2432-equation-times-of-the-day  Problem 2432\u003e.","description_html":"\u003cp\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on the largest consecutive run of equation times that include one of the four basic operations (+,-,*,/) or the power operator (^). Find the largest such consecutive run for a given range of input times (based on three-digit 12-hour times, 1:00 to 9:59). Return the first time stamp (string) and the number of consecutive points (integer, inclusive) for the maximum run (the first run if there is a tie).\u003c/p\u003e\u003cp\u003eFor example, in the 2:07 to 2:29 time range, the answer is ['2:11' 3] since 2:10 has no equation, 2/1=1 (2:11), 2*1=2 (2:12), 2+1=3 (2:13) and 2:14 has no equation, and there are no such runs of four in that range.\u003c/p\u003e\u003cp\u003eThis problem is related to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2431-power-times-of-the-day\"\u003eProblem 2431\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2432-equation-times-of-the-day\"\u003eProblem 2432\u003c/a\u003e.\u003c/p\u003e","function_template":"function [t_s,num] = equation_times_run(times)\r\n t_s = '0:00';\r\n num = 0;\r\nend","test_suite":"%%\r\ntimes = {'1:00' '1:59'};\r\ny_correct = ['1:00' 24];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'2:07' '2:29'};\r\ny_correct = ['2:11' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'3:03' '4:04'};\r\ny_correct = ['3:11' 4];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'5:55' '7:11'};\r\ny_correct = ['6:15' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'7:17' '9:00'};\r\ny_correct = ['8:17' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'5:55' '9:00'};\r\ny_correct = ['6:15' 3];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))\r\n\r\n%%\r\ntimes = {'1:00' '9:59'};\r\ny_correct = ['1:00' 24];\r\n[t_s,num] = equation_times_run(times);\r\nassert(isequal([t_s,num],y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":66,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":45,"created_at":"2014-07-15T19:39:50.000Z","updated_at":"2026-01-15T14:27:21.000Z","published_at":"2014-07-15T19:39:50.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\u003eMany times throughout the day can represent mathematical equations. In this problem, we focus on the largest consecutive run of equation times that include one of the four basic operations (+,-,*,/) or the power operator (^). Find the largest such consecutive run for a given range of input times (based on three-digit 12-hour times, 1:00 to 9:59). Return the first time stamp (string) and the number of consecutive points (integer, inclusive) for the maximum run (the first run if there is a tie).\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\u003eFor example, in the 2:07 to 2:29 time range, the answer is ['2:11' 3] since 2:10 has no equation, 2/1=1 (2:11), 2*1=2 (2:12), 2+1=3 (2:13) and 2:14 has no equation, and there are no such runs of four in that range.\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 problem is related to\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/2431-power-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2431\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/2432-equation-times-of-the-day\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2432\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\"},{\"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:\"multiply\"","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:\"multiply\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"multiply\"","","\"","multiply","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f45e49c6220\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f45e49c6180\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f45e49c58c0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f45e49c64a0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f45e49c6400\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f45e49c6360\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f45e49c62c0\u003e":"tag:\"multiply\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f45e49c62c0\u003e":"tag:\"multiply\""},"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:\"multiply\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"multiply\"","","\"","multiply","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f45e49c6220\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f45e49c6180\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f45e49c58c0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f45e49c64a0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f45e49c6400\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f45e49c6360\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f45e49c62c0\u003e":"tag:\"multiply\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f45e49c62c0\u003e":"tag:\"multiply\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44427,"difficulty_rating":"easy"},{"id":44330,"difficulty_rating":"easy"},{"id":46908,"difficulty_rating":"easy"},{"id":43618,"difficulty_rating":"easy"},{"id":61121,"difficulty_rating":"easy"},{"id":44699,"difficulty_rating":"easy-medium"},{"id":55515,"difficulty_rating":"easy-medium"},{"id":2230,"difficulty_rating":"easy-medium"},{"id":2432,"difficulty_rating":"easy-medium"},{"id":421,"difficulty_rating":"easy-medium"},{"id":42985,"difficulty_rating":"easy-medium"},{"id":553,"difficulty_rating":"easy-medium"},{"id":44262,"difficulty_rating":"medium"},{"id":44263,"difficulty_rating":"medium-hard"},{"id":53705,"difficulty_rating":"medium-hard"},{"id":2433,"difficulty_rating":"medium-hard"}]}}