{"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":44546,"title":"Calculating the total earnings of a factory","description":"The row vector, prods contains the number of various products manufactured per hour. The second row vector, prices holds values for the corresponding item prices they sell the given product for. Given the factory generates operates on a 6-day work week and two 8-hour long shifts per day, find the total earnings.","description_html":"\u003cp\u003eThe row vector, prods contains the number of various products manufactured per hour. The second row vector, prices holds values for the corresponding item prices they sell the given product for. Given the factory generates operates on a 6-day work week and two 8-hour long shifts per day, find the total earnings.\u003c/p\u003e","function_template":"function earn = earnings(rate, price)\r\n    earn= (); % use your basic knowledge of matrix multiplication\r\nend","test_suite":"%%\r\nrate = [2,5,4];\r\nprice = [8,3,1];\r\ny_correct = 3360;\r\nassert(isequal(earnings(rate,price),3360))\r\n%%\r\nrate = [1,4];\r\nprice = [2,1];\r\ny_correct = 576;\r\nassert(isequal(earnings(rate,price),576))\r\n%%\r\nrate = [6 6 2 3 2 8];\r\nprice = [3 2 4 8 9 5];\r\ny_correct = 11520;\r\nassert(isequal(earnings(rate,price),11520))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":171559,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":57,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-03-31T09:16:35.000Z","updated_at":"2026-02-11T11:25:03.000Z","published_at":"2018-03-31T09:16:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eThe row vector, prods contains the number of various products manufactured per hour. The second row vector, prices holds values for the corresponding item prices they sell the given product for. Given the factory generates operates on a 6-day work week and two 8-hour long shifts per day, find the total earnings.\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":44300,"title":"Matrix Generation from Vector Multiplication","description":"Output the matrix generated from multiplying two vectors together","description_html":"\u003cp\u003eOutput the matrix generated from multiplying two vectors together\u003c/p\u003e","function_template":"function out_matrix = your_fcn_name(x,y)\r\n  out_matrix = ...;\r\nend","test_suite":"%%\r\nx = [1; 2];\r\ny = [1 2];\r\nout_matrix = [1 2; 2 4];\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = (1:3)';\r\ny = 1:3;\r\nout_matrix = [1,2,3;2,4,6;3,6,9];\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = ones(10,1);\r\ny = ones(1,10);\r\nout_matrix = ones(10);\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = ones(1,10);\r\ny = ones(10,1);\r\nout_matrix = 10;\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = ones(3,1);\r\ny = [7 6 8];\r\nout_matrix = repmat(y,[3,1]);\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = [1;0;1;0;1];\r\ny = [0,1,0,1,0];\r\nout_matrix = [0,1,0,1,0;0,0,0,0,0;0,1,0,1,0;0,0,0,0,0;0,1,0,1,0];\r\nassert(isequal(your_fcn_name(x,y),out_matrix))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":12852,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":95,"test_suite_updated_at":"2017-09-08T19:39:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-06T01:11:33.000Z","updated_at":"2026-02-11T18:40:07.000Z","published_at":"2017-09-06T01:11:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eOutput the matrix generated from multiplying two vectors together\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":44425,"title":"currency converter","description":"given a rate of exchange calculate the equivalent units of 100 USD ","description_html":"\u003cp\u003egiven a rate of exchange calculate the equivalent units of 100 USD\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%% test 1 (euro)\r\nx = 0.84059;\r\ny_correct = 84.059;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%% test 2 (GBP)\r\nx = 0.74221;\r\ny_correct = 74.221;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%% test 3 (australian)\r\nx = 1.31283\r\ny_correct = 131.283;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":114,"test_suite_updated_at":"2017-12-02T14:32:53.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T14:26:00.000Z","updated_at":"2026-02-13T15:33:12.000Z","published_at":"2017-12-02T14:26:00.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven a rate of exchange calculate the equivalent units of 100 USD\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":44299,"title":"Vector Element Multiplication","description":"Take two incoming vectors, and output the element wise multiplication of the vectors.","description_html":"\u003cp\u003eTake two incoming vectors, and output the element wise multiplication of the vectors.\u003c/p\u003e","function_template":"function ele_mult_vec = your_fcn_name(x,y)\r\n  ele_mult_vec = ...;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 5];\r\ny = [1 2 3 4 5];\r\nele_mult_vec = [1 4 9 16 25];\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = ones(1,10);\r\ny = ones(1,10);\r\nele_mult_vec = ones(1,10);\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = ones(1,10);\r\ny = 10:10:100;\r\nele_mult_vec = 10:10:100;\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = 10:10:100;\r\ny = 0.1*ones(1,10);\r\nele_mult_vec = 1:10;\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = 1:3;\r\ny = 4:6;\r\nele_mult_vec = [4 10 18];\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = mod(1:100,2);\r\ny = mod([2:100,1],2);\r\nele_mult_vec = zeros(1,100);\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":12852,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":124,"test_suite_updated_at":"2017-09-08T19:34:56.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-06T01:08:51.000Z","updated_at":"2026-02-11T18:34:27.000Z","published_at":"2017-09-06T01:08:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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 output the element wise multiplication of the vectors.\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":44329,"title":"Matrix multiplication","description":"Multiply two incoming matrices via matrix multiplication","description_html":"\u003cp\u003eMultiply two incoming matrices via matrix multiplication\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 = [     8     5;    20    13];\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":171,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-14T17:35:40.000Z","updated_at":"2026-02-11T18:28:55.000Z","published_at":"2017-09-14T17:35:40.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 incoming matrices via matrix multiplication\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":2928,"title":"Find the product of a Vector","description":"How would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 2?;\r\n\r\nx = [1 : 0.5 : 6];\r\n\r\ny = x;\r\n\r\n","description_html":"\u003cp\u003eHow would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 2?;\u003c/p\u003e\u003cp\u003ex = [1 : 0.5 : 6];\u003c/p\u003e\u003cp\u003ey = x;\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1:0.5:6];\r\ny_correct =  [2:12];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":34004,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":348,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-02-02T15:58:19.000Z","updated_at":"2026-02-10T21:50:52.000Z","published_at":"2015-02-02T15:58:19.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\u003eHow would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 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\u003ex = [1 : 0.5 : 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\u003ey = x;\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":2030,"title":"A Poker Hand","description":"Texas Hold ‘Em is a classical card game. In this problem, we are concerned with determining the probability of attaining a certain type of hand.\r\n\r\nA “Full House” is a five card hand comprised composed of two sets: a set of three of a kind, and a set of two of a kind. Examples include: K-K-K-Q-Q, 10-10-10-5-5, and A-A-A-4-4.\r\n\r\nAssuming that there are 52 cards in a unique, distinguishable deck, find the probability of attaining a “Full House” in any given hand. You may assume that there are 9 players playing on a full table.\r\n","description_html":"\u003cp\u003eTexas Hold ‘Em is a classical card game. In this problem, we are concerned with determining the probability of attaining a certain type of hand.\u003c/p\u003e\u003cp\u003eA “Full House” is a five card hand comprised composed of two sets: a set of three of a kind, and a set of two of a kind. Examples include: K-K-K-Q-Q, 10-10-10-5-5, and A-A-A-4-4.\u003c/p\u003e\u003cp\u003eAssuming that there are 52 cards in a unique, distinguishable deck, find the probability of attaining a “Full House” in any given hand. You may assume that there are 9 players playing on a full table.\u003c/p\u003e","function_template":"function y = fullHouse(x)\r\nx=52; %number of cards in a deck\r\n%siginificant to 7 digits (for luck)\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0.0144058;\r\nassert(isequal(fullHouse(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":16441,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-12-02T07:52:42.000Z","updated_at":"2025-06-08T09:16:04.000Z","published_at":"2013-12-02T08:00:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eTexas Hold ‘Em is a classical card game. In this problem, we are concerned with determining the probability of attaining a certain type of hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA “Full House” is a five card hand comprised composed of two sets: a set of three of a kind, and a set of two of a kind. Examples include: K-K-K-Q-Q, 10-10-10-5-5, and A-A-A-4-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\u003eAssuming that there are 52 cards in a unique, distinguishable deck, find the probability of attaining a “Full House” in any given hand. You may assume that there are 9 players playing on a full table.\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":2161,"title":"Let's get back to school, and create multiplication tables","description":"For a given range, create multiplication tables. (start is always \u003c endno)\r\n\r\nExample\r\n\r\n start = 17\r\n endno = 19\r\n\r\nThen, \r\n\r\n table = \r\n  [ 17    18    19\r\n    34    36    38\r\n    51    54    57\r\n    68    72    76\r\n    85    90    95\r\n   102   108   114\r\n   119   126   133\r\n   136   144   152\r\n   153   162   171\r\n   170   180   190 ]\r\n","description_html":"\u003cp\u003eFor a given range, create multiplication tables. (start is always \u0026lt; endno)\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e start = 17\r\n endno = 19\u003c/pre\u003e\u003cp\u003eThen,\u003c/p\u003e\u003cpre\u003e table = \r\n  [ 17    18    19\r\n    34    36    38\r\n    51    54    57\r\n    68    72    76\r\n    85    90    95\r\n   102   108   114\r\n   119   126   133\r\n   136   144   152\r\n   153   162   171\r\n   170   180   190 ]\u003c/pre\u003e","function_template":"function table= Tables(start, endno)\r\n  table = [start:endno];\r\nend","test_suite":"%%\r\nstart = 1;\r\nendno = 10;\r\ny_correct = [1     2     3     4     5     6     7     8     9    10;\r\n     2     4     6     8    10    12    14    16    18    20;\r\n     3     6     9    12    15    18    21    24    27    30;\r\n     4     8    12    16    20    24    28    32    36    40;\r\n     5    10    15    20    25    30    35    40    45    50;\r\n     6    12    18    24    30    36    42    48    54    60;\r\n     7    14    21    28    35    42    49    56    63    70;\r\n     8    16    24    32    40    48    56    64    72    80;\r\n     9    18    27    36    45    54    63    72    81    90;\r\n    10    20    30    40    50    60    70    80    90   100;];\r\nassert(isequal(Tables(start, endno),y_correct))\r\n\r\n%%\r\nstart = 17;\r\nendno = 19;\r\ny_correct = [17    18    19;\r\n    34    36    38;\r\n    51    54    57;\r\n    68    72    76;\r\n    85    90    95;\r\n   102   108   114;\r\n   119   126   133;\r\n   136   144   152;\r\n   153   162   171;\r\n   170   180   190;];\r\nassert(isequal(Tables(start, endno),y_correct))\r\n\r\n%%\r\nstart = 21;\r\nendno = 22;\r\n\r\ny_correct =[21    22;\r\n    42    44;\r\n    63    66;\r\n    84    88;\r\n   105   110;\r\n   126   132;\r\n   147   154;\r\n   168   176;\r\n   189   198;\r\n   210   220;]\r\nassert(isequal(Tables(start, endno),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":240,"test_suite_updated_at":"2014-02-06T17:58:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-06T17:45:15.000Z","updated_at":"2026-04-03T02:41:10.000Z","published_at":"2014-02-06T17:49:12.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\u003eFor a given range, create multiplication tables. (start is always \u0026lt; endno)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ start = 17\\n endno = 19]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThen,\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[ table = \\n  [ 17    18    19\\n    34    36    38\\n    51    54    57\\n    68    72    76\\n    85    90    95\\n   102   108   114\\n   119   126   133\\n   136   144   152\\n   153   162   171\\n   170   180   190 ]]]\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":2381,"title":"Sum of digit range","description":"Example: \r\n\r\nIf A is n1, and B is n2 digit positive numbers. A*B's digit range will be [c d] (c = min \u0026 d = max). \r\nThen return c+d.","description_html":"\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003eIf A is n1, and B is n2 digit positive numbers. A*B's digit range will be [c d] (c = min \u0026 d = max). \r\nThen return c+d.\u003c/p\u003e","function_template":"function result = digitrange(n1,n2)\r\nresult = n1/n2;\r\nend","test_suite":"%%\r\nn1 = 758; n2 = 469;\r\ny_correct = 2453;\r\nassert(isequal(digitrange(n1,n2),y_correct))\r\n\r\n%%\r\nn1 = 6.23e4; n2 = 12;\r\ny_correct = 124623;\r\nassert(isequal(digitrange(n1,n2),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":5,"created_by":27005,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":48,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-06-21T14:10:26.000Z","updated_at":"2025-07-19T04:59:52.000Z","published_at":"2014-06-21T14:10:29.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\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf A is n1, and B is n2 digit positive numbers. A*B's digit range will be [c d] (c = min \u0026amp; d = max). Then return c+d.\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":2178,"title":"Matrix multiplication across rows","description":"Given matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix\r\n\r\nExample\r\n \r\n m = [ 1 2 3\r\n       4 5 6\r\n       7 8 9 ]\r\n\r\nThen\r\n\r\n n = [ 1   2    6\r\n       4  20  120\r\n       7  56  504 ]\r\n\r\n","description_html":"\u003cp\u003eGiven matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e m = [ 1 2 3\r\n       4 5 6\r\n       7 8 9 ]\u003c/pre\u003e\u003cp\u003eThen\u003c/p\u003e\u003cpre\u003e n = [ 1   2    6\r\n       4  20  120\r\n       7  56  504 ]\u003c/pre\u003e","function_template":"function y = MatMultiply(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx =[ 1 2 3; 4 5 6; 7 8 9];\r\ny_correct = [1 2 6;4 20 120; 7 56 504];\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n%%\r\nx =reshape([1:10], 2,5);\r\ny_correct =   [ 1  3  15  105  945;\r\n                2  8  48  384  3840;];\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n%%\r\nx =eye(5);\r\ny_correct =   [     1     0     0     0     0;\r\n                    0     0     0     0     0;\r\n                    0     0     0     0     0;\r\n                    0     0     0     0     0;\r\n                    0     0     0     0     0;];\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n%%\r\nx =ones(7);\r\ny_correct = ones(7);\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":397,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":23,"created_at":"2014-02-12T21:23:36.000Z","updated_at":"2026-02-21T21:53:13.000Z","published_at":"2014-02-12T21:24:55.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 matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ m = [ 1 2 3\\n       4 5 6\\n       7 8 9 ]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThen\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[ n = [ 1   2    6\\n       4  20  120\\n       7  56  504 ]]]\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":336,"title":"Similar Triangles - find the height of the tree","description":"Given the height, h1, of a power pole, shorter than a tree, a given distance, x2 away, please find h2, height of the tree. Please note that the angle, phi, is the acute angle measured from the ground to an observer's line of sight aimed to the sucessive peaks of the power pole and the tree, in that order. Also the distance from the observer to the power pole is x1, also a given. x2 is the distance between the tree and the power pole. In all tests x1 is always a multiple of x2.\r\n\r\n\r\nInputs: h1, x1, x2\r\n\r\nOutput: h2\r\n\r\nHINT: find phi, given h1 and x1. Phi may be measured in degrees or radians. Note that default trig functions in MATLAB operate in radians.\r\n\r\nEX:\r\nx1 = 4;\r\nx2 = 4;\r\nh1 = 3;\r\n\r\n\u003e\u003eh2=findHeight(x1,x2,h1)\r\n\r\nh2=6\r\n\r\n\u003e\u003e","description_html":"\u003cp\u003eGiven the height, h1, of a power pole, shorter than a tree, a given distance, x2 away, please find h2, height of the tree. Please note that the angle, phi, is the acute angle measured from the ground to an observer's line of sight aimed to the sucessive peaks of the power pole and the tree, in that order. Also the distance from the observer to the power pole is x1, also a given. x2 is the distance between the tree and the power pole. In all tests x1 is always a multiple of x2.\u003c/p\u003e\u003cp\u003eInputs: h1, x1, x2\u003c/p\u003e\u003cp\u003eOutput: h2\u003c/p\u003e\u003cp\u003eHINT: find phi, given h1 and x1. Phi may be measured in degrees or radians. Note that default trig functions in MATLAB operate in radians.\u003c/p\u003e\u003cp\u003eEX:\r\nx1 = 4;\r\nx2 = 4;\r\nh1 = 3;\u003c/p\u003e\u003cp\u003e\u003e\u003eh2=findHeight(x1,x2,h1)\u003c/p\u003e\u003cp\u003eh2=6\u003c/p\u003e\u003cp\u003e\u003e\u003e\u003c/p\u003e","function_template":"function h2 = findHeight(x1,x2,h1)\r\n  h2 = heightoftree\r\nend","test_suite":"%%\r\nx1 = 4;\r\nx2 = 4;\r\nh1 = 3;\r\ny_correct = 6;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 8;\r\nh1 = 3;\r\ny_correct = 9;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 12;\r\nh1 = 3;\r\ny_correct = 12;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 16;\r\nh1 = 3;\r\ny_correct = 15;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 20;\r\nh1 = 3;\r\ny_correct = 18;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 24;\r\nh1 = 3;\r\ny_correct = 21;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 12;\r\nh1 = 5;\r\ny_correct = 20;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 16;\r\nh1 = 10;\r\ny_correct = 50;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 2;\r\nx2 = 4;\r\nh1 = 5;\r\ny_correct = 15;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 3;\r\nx2 = 6;\r\nh1 = 4;\r\ny_correct = 12;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":6,"created_by":1103,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":469,"test_suite_updated_at":"2012-02-18T04:42:47.000Z","rescore_all_solutions":false,"group_id":17,"created_at":"2012-02-17T22:52:21.000Z","updated_at":"2026-03-13T05:26:44.000Z","published_at":"2012-02-18T04:42:47.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 the height, h1, of a power pole, shorter than a tree, a given distance, x2 away, please find h2, height of the tree. Please note that the angle, phi, is the acute angle measured from the ground to an observer's line of sight aimed to the sucessive peaks of the power pole and the tree, in that order. Also the distance from the observer to the power pole is x1, also a given. x2 is the distance between the tree and the power pole. In all tests x1 is always a multiple of x2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs: h1, x1, x2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput: h2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHINT: find phi, given h1 and x1. Phi may be measured in degrees or radians. Note that default trig functions in MATLAB operate in radians.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEX: x1 = 4; x2 = 4; h1 = 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\u003e\u003eh2=findHeight(x1,x2,h1)\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\u003eh2=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\u003e\u003e\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":2157,"title":"Multiplication","description":"Multiply two numbers in a different manner.\r\nThe numbers are given to you as vectors x and y.\r\n\r\nExample\r\n\r\n x = [ 1 2 0 1 ]\r\n\r\n y = [ 8 5 1 ]\r\n\r\n      1  2  0  1\r\n X       8  5  1\r\n-------------------\r\n      1  2  0  1\r\n   5 10  0  5\r\n8 16  0  8\r\n----------------\r\n8 21 11 10  5  1 \r\n\r\n","description_html":"\u003cp\u003eMultiply two numbers in a different manner.\r\nThe numbers are given to you as vectors x and y.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e x = [ 1 2 0 1 ]\u003c/pre\u003e\u003cpre\u003e y = [ 8 5 1 ]\u003c/pre\u003e\u003cpre\u003e      1  2  0  1\r\n X       8  5  1\r\n-------------------\r\n      1  2  0  1\r\n   5 10  0  5\r\n8 16  0  8\r\n----------------\r\n8 21 11 10  5  1 \u003c/pre\u003e","function_template":"function result= muldif(x,y)\r\n  result = (x*y);\r\nend","test_suite":"%%\r\nx=[1 2];\r\ny=1;\r\ny_correct=[1 2];\r\nassert(isequal(muldif(x,y),y_correct));\r\n%%\r\nx=1;\r\ny=1;\r\ny_correct=1;\r\nassert(isequal(muldif(x,y),y_correct));\r\n%%\r\nx=[1 2 0 1];\r\ny=[8 5 1];\r\ny_correct = [8 21 11 10  5  1];\r\nassert(isequal(muldif(x,y),y_correct))\r\n%%\r\nx=[1 2 3 4 4 1 2 1 1 1];\r\ny=[1 2 3 4 5 6 9 10];\r\n y_correct=[1     4    10    20    34    49    68    90   104   109   101    73    43    40    25    19    10];\r\nassert(isequal(muldif(x,y),y_correct));\r\n%%\r\nx=[1:10 0 1];\r\ny=[8 5:1:25 1];\r\ny_correct = [8\t21\t40\t66\t100\t143\t196\t260\t336\t425\t440\t503\t555\t611\t667\t723\t779\t835\t891\t947\t1003\t1059\t1090\t1094\t1070\t1017\t934\t820\t674\t495\t282\t34\t25\t1\r\n];\r\nassert(isequal(muldif(x,y),y_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":3,"created_by":22216,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":113,"test_suite_updated_at":"2014-02-06T11:37:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-06T09:07:12.000Z","updated_at":"2026-04-03T03:17:32.000Z","published_at":"2014-02-06T09:07:12.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\u003eMultiply two numbers in a different manner. The numbers are given to you as vectors 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=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [ 1 2 0 1 ]\\n\\n y = [ 8 5 1 ]\\n\\n      1  2  0  1\\n X       8  5  1\\n-------------------\\n      1  2  0  1\\n   5 10  0  5\\n8 16  0  8\\n----------------\\n8 21 11 10  5  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":813,"title":"Multiply 2 numbers ","description":"Very easy, you just have to multiply 2 numbers\r\nbut you cannot use the  following signs (*, /, - ,^) ,mtimes , times, cross, prod, cumprod , dec2bin, int2str and num2str functions. Will you take up the challenge?!\r\n\r\nExample :\r\nx= 3;\r\ny= 2;\r\n\r\noutput = 6 since 3*2 = 6 :)","description_html":"\u003cp\u003eVery easy, you just have to multiply 2 numbers\r\nbut you cannot use the  following signs (*, /, - ,^) ,mtimes , times, cross, prod, cumprod , dec2bin, int2str and num2str functions. Will you take up the challenge?!\u003c/p\u003e\u003cp\u003eExample :\r\nx= 3;\r\ny= 2;\u003c/p\u003e\u003cp\u003eoutput = 6 since 3*2 = 6 :)\u003c/p\u003e","function_template":"function output = your_fcn_name(x,y)\r\n  y = x*y;\r\nend","test_suite":"%%\r\nx = 1;\r\ny =2;\r\ny_correct = 2;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')),'sign * forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'mldivide')))\r\nassert(isempty(strfind(filetext, 'mrdivide')))\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')))\r\nassert(isempty(strfind(filetext, '-')))\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')))\r\nassert(isempty(strfind(filetext, '''')),'string forbidden')\r\n\r\n%%\r\nx = 8;\r\ny =25;\r\ny_correct = 200;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n%%\r\nx = 8;\r\ny =0;\r\ny_correct = 0;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n\r\n%%\r\nx = -148;\r\ny =2865;\r\ny_correct = -424020;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n%% Test 5 : randi!!\r\nx = randi([1 58]);\r\ny =286.5;\r\ny_correct = x*y;\r\nassert(abs( your_fcn_name(x,y)-y_correct)\u003c1e-9)\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n\r\n%% Test 6 : randi and pi !!\r\nx = randi([14 580]);\r\ny = -pi;\r\ny_correct = x*y;\r\nassert(abs( your_fcn_name(x,y)-y_correct)\u003c1e-9)\r\n\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\nassert(isempty(strfind(filetext, 'num2str')))\r\nassert(isempty(strfind(filetext, 'int2str')))\r\nassert(isempty(strfind(filetext, 'dec2bin')))\r\n","published":true,"deleted":false,"likes_count":21,"comments_count":4,"created_by":639,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":348,"test_suite_updated_at":"2012-07-10T12:45:28.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-07-04T09:34:18.000Z","updated_at":"2026-03-28T02:08:05.000Z","published_at":"2012-07-04T09:34:18.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\u003eVery easy, you just have to multiply 2 numbers but you cannot use the following signs (*, /, - ,^) ,mtimes , times, cross, prod, cumprod , dec2bin, int2str and num2str functions. Will you take up the challenge?!\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 : x= 3; y= 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\u003eoutput = 6 since 3*2 = 6 :)\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":44786,"title":"Lunar Arithmetic (Multiplication)","description":"\u003chttps://oeis.org/A087061 OEIS link for a description of lunar arithmetic\u003e\r\n\r\nSimply take the larger digit when adding and take the smaller digit when multiplying. \r\n\r\nExample \r\n\r\n        15866\r\n     X    147\r\n     _________\r\n        15766\r\n       14444\r\n    + 11111\r\n    __________\r\n      1145766","description_html":"\u003cp\u003e\u003ca href = \"https://oeis.org/A087061\"\u003eOEIS link for a description of lunar arithmetic\u003c/a\u003e\u003c/p\u003e\u003cp\u003eSimply take the larger digit when adding and take the smaller digit when multiplying.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e        15866\r\n     X    147\r\n     _________\r\n        15766\r\n       14444\r\n    + 11111\r\n    __________\r\n      1145766\u003c/pre\u003e","function_template":"function lunarMult = lunarMultiplication(x,y)\r\n  lunarMult = x * y\r\nend","test_suite":"\r\n\r\nfiletext = fileread('lunarMultiplication.m');\r\nassert(isempty(strfind(filetext, 'assert')))\r\nassert(isempty(strfind(filetext, 'echo')))\r\n\r\n%%\r\nx = 15866;\r\ny = 147;\r\nassert(isequal(lunarMultiplication(x,y),1145766))\r\n\r\n%%\r\nx = 169;\r\ny = 248;\r\nassert(isequal(lunarMultiplication(x,y),12468))\r\n\r\n%%\r\nx = 7;\r\ny = 4;\r\nassert(isequal(lunarMultiplication(x,y),4))\r\n\r\n\r\n%%\r\nx = 78;\r\ny = 4;\r\nassert(isequal(lunarMultiplication(x,y),44))\r\n\r\n\r\n%%\r\nx = 7799123;\r\ny = 109;\r\nassert(isequal(lunarMultiplication(x,y),117799123))","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":49,"test_suite_updated_at":"2019-04-22T12:02:07.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-11-10T06:01:37.000Z","updated_at":"2026-03-20T13:37:48.000Z","published_at":"2018-11-10T06:01:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A087061\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOEIS link for a description of lunar arithmetic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eSimply take the larger digit when adding and take the smaller digit when multiplying.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[        15866\\n     X    147\\n     _________\\n        15766\\n       14444\\n    + 11111\\n    __________\\n      1145766]]\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":110,"title":"Make an N-dimensional Multiplication Table","description":"*INSTRUCTIONS*\r\n\r\nThis is a multi-dimensional variant of the normal multiplication table used to teach elementary students multiplication. In this variant, we are going to produce a table that multiplies the divisors 1 to _n_ (input) agains itself in _d_ dimensions.\r\n\r\n_Note_: Inputting _d_ = 0 should return the number 1 and _d_ = 1 should return a column vector with the elements 1 to _n_.\r\n\r\n\r\n*Example:*\r\n\r\nInput: \r\n\r\n  n = 3;\r\n  d = 3;\r\n\r\nOutput:\r\n\r\n  tt(:,:,1) = [ 1  2  3\r\n                2  4  6\r\n                3  6  9  ];\r\n  tt(:,:,2) = [ 2  4  6\r\n                4  8  12\r\n                6  12 18 ];\r\n  tt(:,:,3) = [ 3  6  9\r\n                6  12 18\r\n                9  18 27 ];","description_html":"\u003cp\u003e\u003cb\u003eINSTRUCTIONS\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is a multi-dimensional variant of the normal multiplication table used to teach elementary students multiplication. In this variant, we are going to produce a table that multiplies the divisors 1 to \u003ci\u003en\u003c/i\u003e (input) agains itself in \u003ci\u003ed\u003c/i\u003e dimensions.\u003c/p\u003e\u003cp\u003e\u003ci\u003eNote\u003c/i\u003e: Inputting \u003ci\u003ed\u003c/i\u003e = 0 should return the number 1 and \u003ci\u003ed\u003c/i\u003e = 1 should return a column vector with the elements 1 to \u003ci\u003en\u003c/i\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eInput:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003en = 3;\r\nd = 3;\r\n\u003c/pre\u003e\u003cp\u003eOutput:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ett(:,:,1) = [ 1  2  3\r\n              2  4  6\r\n              3  6  9  ];\r\ntt(:,:,2) = [ 2  4  6\r\n              4  8  12\r\n              6  12 18 ];\r\ntt(:,:,3) = [ 3  6  9\r\n              6  12 18\r\n              9  18 27 ];\r\n\u003c/pre\u003e","function_template":"function tt = ndtimestable(n,d)\r\n  tt = zeros(n*ones(1,d));\r\nend","test_suite":"%%\r\nm = 5;\r\nn = 0;\r\ntt = 1;\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 10;\r\nn = 1;\r\ntt = (1:10)';\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 12;\r\nn = 2;\r\ntt= [    1     2     3     4     5     6     7     8     9    10    11    12\r\n         2     4     6     8    10    12    14    16    18    20    22    24\r\n         3     6     9    12    15    18    21    24    27    30    33    36\r\n         4     8    12    16    20    24    28    32    36    40    44    48\r\n         5    10    15    20    25    30    35    40    45    50    55    60\r\n         6    12    18    24    30    36    42    48    54    60    66    72\r\n         7    14    21    28    35    42    49    56    63    70    77    84\r\n         8    16    24    32    40    48    56    64    72    80    88    96\r\n         9    18    27    36    45    54    63    72    81    90    99   108\r\n        10    20    30    40    50    60    70    80    90   100   110   120\r\n        11    22    33    44    55    66    77    88    99   110   121   132\r\n        12    24    36    48    60    72    84    96   108   120   132   144  ];\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 3;\r\nn = 3;\r\ntt = zeros(m,m,m);\r\ntt(:,:,1) = [ 1  2  3\r\n              2  4  6\r\n              3  6  9  ];\r\ntt(:,:,2) = [ 2  4  6\r\n              4  8  12\r\n              6  12 18 ];\r\ntt(:,:,3) = [ 3  6  9\r\n              6  12 18\r\n              9  18 27 ];\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 2;\r\nn = 4;\r\ntt = zeros(m,m,m,m);\r\ntt(:,:,1,1) = ...\r\n  [  1     2\r\n     2     4  ];\r\ntt(:,:,2,1) = ...\r\n  [  2     4\r\n     4     8  ];\r\ntt(:,:,1,2) = ...\r\n  [  2     4\r\n     4     8  ];\r\ntt(:,:,2,2) = ...\r\n  [  4     8\r\n     8    16  ];\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 2;\r\nn = 7;\r\nassert(numel(ndtimestable(m,n)) == m^n);","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":141,"test_suite_updated_at":"2012-01-26T15:30:12.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-01-26T15:17:25.000Z","updated_at":"2026-04-03T03:18:48.000Z","published_at":"2012-01-26T15:30:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eINSTRUCTIONS\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 is a multi-dimensional variant of the normal multiplication table used to teach elementary students multiplication. In this variant, we are going to produce a table that multiplies the divisors 1 to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (input) agains itself in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e dimensions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNote\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Inputting\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e = 0 should return the number 1 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:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e = 1 should return a column vector with the elements 1 to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput:\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[n = 3;\\nd = 3;]]\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\u003eOutput:\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[tt(:,:,1) = [ 1  2  3\\n              2  4  6\\n              3  6  9  ];\\ntt(:,:,2) = [ 2  4  6\\n              4  8  12\\n              6  12 18 ];\\ntt(:,:,3) = [ 3  6  9\\n              6  12 18\\n              9  18 27 ];]]\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":2237,"title":"Mmm! Multi-dimensional Matrix Multiplication ","description":"You have got a couple of multi-dimensional matrices, A and B. And want to multiply them. For the first 2 dimensions, an ordinary matrix multiplication applies. And in the other dimensions? Well, they just act as parallel worlds. All 2D matrices are multiplied, for every element in the other dimensions.\r\nYou may assume that the size in the 1st two dimensions allows simple matrix multiplication: A(:,:,1)*B(:,:,1), so size(A(:,:,1),2) == size(B(:,:,1),1), or either A(:,:,1) is a scalar or B(:,:,1) is a scalar.\r\nIn the other dimensions, the sizes of A and B should be eqaal, size(A,n) == size(B,n), for n\u003e2, or either ndims(A)\u003cn or ndims(B)\u003cn, or either size(A,n)==1 or size(B,n)==1, so one of them is a scalar.\r\n\r\nWrite a function |mtimesm| that does this, and ask Mathworks to include it in the |elmat| toolbox of the Next Release.","description_html":"\u003cp\u003eYou have got a couple of multi-dimensional matrices, A and B. And want to multiply them. For the first 2 dimensions, an ordinary matrix multiplication applies. And in the other dimensions? Well, they just act as parallel worlds. All 2D matrices are multiplied, for every element in the other dimensions.\r\nYou may assume that the size in the 1st two dimensions allows simple matrix multiplication: A(:,:,1)*B(:,:,1), so size(A(:,:,1),2) == size(B(:,:,1),1), or either A(:,:,1) is a scalar or B(:,:,1) is a scalar.\r\nIn the other dimensions, the sizes of A and B should be eqaal, size(A,n) == size(B,n), for n\u0026gt;2, or either ndims(A)\u0026lt;n or ndims(B)\u0026lt;n, or either size(A,n)==1 or size(B,n)==1, so one of them is a scalar.\u003c/p\u003e\u003cp\u003eWrite a function \u003ctt\u003emtimesm\u003c/tt\u003e that does this, and ask Mathworks to include it in the \u003ctt\u003eelmat\u003c/tt\u003e toolbox of the Next Release.\u003c/p\u003e","function_template":"function C = mtimesm(A,B)\r\n  C = A*B;\r\nend","test_suite":"%% case 1\r\nA = 1;\r\nB = 2;\r\nC = mtimesm(A,B);\r\nC_correct = 2;\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 2\r\nA = rand(2,3);\r\nB = rand(3,4);\r\nC = mtimesm(A,B);\r\nC_correct = A*B;\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 3\r\nA = rand(2,3);\r\nB = 2;\r\nC = mtimesm(A,B);\r\nC_correct = 2*A;\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 4\r\nA = rand(2,3,2);\r\nB = rand(3,4,2);\r\nC = mtimesm(A,B);\r\nC_correct = cat(3,A(:,:,1)*B(:,:,1),A(:,:,2)*B(:,:,2));\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 5\r\nA = rand(2,3,3);\r\nB = rand(3,4);\r\nC = mtimesm(A,B);\r\nC_correct = cat(3,A(:,:,1)*B,A(:,:,2)*B,A(:,:,3)*B); \r\nassert(isequal(C,C_correct))\r\n\r\n%% case 6\r\nA = rand(4,3,1,2);\r\nB = rand(3,2,2);\r\nC = mtimesm(A,B);\r\nC_correct(:,:,1,1) = A(:,:,1,1)*B(:,:,1);\r\nC_correct(:,:,1,2) = A(:,:,1,2)*B(:,:,1);\r\nC_correct(:,:,2,1) = A(:,:,1,1)*B(:,:,2);\r\nC_correct(:,:,2,2) = A(:,:,1,2)*B(:,:,2);\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 7\r\nA = rand(4,3,1,2);\r\nB = rand(3,2,1,1,2);\r\nC = mtimesm(A,B);\r\nC_correct(:,:,1,1,1) = A(:,:,1,1)*B(:,:,1,1,1);\r\nC_correct(:,:,1,1,2) = A(:,:,1,1)*B(:,:,1,1,2);\r\nC_correct(:,:,1,2,1) = A(:,:,1,2)*B(:,:,1,1,1);\r\nC_correct(:,:,1,2,2) = A(:,:,1,2)*B(:,:,1,1,2);\r\nassert(isequal(C,C_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":5,"created_by":6556,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":"2014-03-07T06:22:58.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-03-06T11:17:42.000Z","updated_at":"2026-04-03T03:22:22.000Z","published_at":"2014-03-06T11:17:42.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou have got a couple of multi-dimensional matrices, A and B. And want to multiply them. For the first 2 dimensions, an ordinary matrix multiplication applies. And in the other dimensions? Well, they just act as parallel worlds. All 2D matrices are multiplied, for every element in the other dimensions. You may assume that the size in the 1st two dimensions allows simple matrix multiplication: A(:,:,1)*B(:,:,1), so size(A(:,:,1),2) == size(B(:,:,1),1), or either A(:,:,1) is a scalar or B(:,:,1) is a scalar. In the other dimensions, the sizes of A and B should be eqaal, size(A,n) == size(B,n), for n\u0026gt;2, or either ndims(A)\u0026lt;n or ndims(B)\u0026lt;n, or either size(A,n)==1 or size(B,n)==1, so one of them is a scalar.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function\u003c/w:t\u003e\u003c/w:r\u003e\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\u003emtimesm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that does this, and ask Mathworks to include it 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:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eelmat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e toolbox of the Next Release.\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":44546,"title":"Calculating the total earnings of a factory","description":"The row vector, prods contains the number of various products manufactured per hour. The second row vector, prices holds values for the corresponding item prices they sell the given product for. Given the factory generates operates on a 6-day work week and two 8-hour long shifts per day, find the total earnings.","description_html":"\u003cp\u003eThe row vector, prods contains the number of various products manufactured per hour. The second row vector, prices holds values for the corresponding item prices they sell the given product for. Given the factory generates operates on a 6-day work week and two 8-hour long shifts per day, find the total earnings.\u003c/p\u003e","function_template":"function earn = earnings(rate, price)\r\n    earn= (); % use your basic knowledge of matrix multiplication\r\nend","test_suite":"%%\r\nrate = [2,5,4];\r\nprice = [8,3,1];\r\ny_correct = 3360;\r\nassert(isequal(earnings(rate,price),3360))\r\n%%\r\nrate = [1,4];\r\nprice = [2,1];\r\ny_correct = 576;\r\nassert(isequal(earnings(rate,price),576))\r\n%%\r\nrate = [6 6 2 3 2 8];\r\nprice = [3 2 4 8 9 5];\r\ny_correct = 11520;\r\nassert(isequal(earnings(rate,price),11520))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":171559,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":57,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-03-31T09:16:35.000Z","updated_at":"2026-02-11T11:25:03.000Z","published_at":"2018-03-31T09:16:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eThe row vector, prods contains the number of various products manufactured per hour. The second row vector, prices holds values for the corresponding item prices they sell the given product for. Given the factory generates operates on a 6-day work week and two 8-hour long shifts per day, find the total earnings.\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":44300,"title":"Matrix Generation from Vector Multiplication","description":"Output the matrix generated from multiplying two vectors together","description_html":"\u003cp\u003eOutput the matrix generated from multiplying two vectors together\u003c/p\u003e","function_template":"function out_matrix = your_fcn_name(x,y)\r\n  out_matrix = ...;\r\nend","test_suite":"%%\r\nx = [1; 2];\r\ny = [1 2];\r\nout_matrix = [1 2; 2 4];\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = (1:3)';\r\ny = 1:3;\r\nout_matrix = [1,2,3;2,4,6;3,6,9];\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = ones(10,1);\r\ny = ones(1,10);\r\nout_matrix = ones(10);\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = ones(1,10);\r\ny = ones(10,1);\r\nout_matrix = 10;\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = ones(3,1);\r\ny = [7 6 8];\r\nout_matrix = repmat(y,[3,1]);\r\nassert(isequal(your_fcn_name(x,y),out_matrix))\r\n\r\n%%\r\nx = [1;0;1;0;1];\r\ny = [0,1,0,1,0];\r\nout_matrix = [0,1,0,1,0;0,0,0,0,0;0,1,0,1,0;0,0,0,0,0;0,1,0,1,0];\r\nassert(isequal(your_fcn_name(x,y),out_matrix))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":12852,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":95,"test_suite_updated_at":"2017-09-08T19:39:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-06T01:11:33.000Z","updated_at":"2026-02-11T18:40:07.000Z","published_at":"2017-09-06T01:11:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eOutput the matrix generated from multiplying two vectors together\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":44425,"title":"currency converter","description":"given a rate of exchange calculate the equivalent units of 100 USD ","description_html":"\u003cp\u003egiven a rate of exchange calculate the equivalent units of 100 USD\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%% test 1 (euro)\r\nx = 0.84059;\r\ny_correct = 84.059;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%% test 2 (GBP)\r\nx = 0.74221;\r\ny_correct = 74.221;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%% test 3 (australian)\r\nx = 1.31283\r\ny_correct = 131.283;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":114,"test_suite_updated_at":"2017-12-02T14:32:53.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T14:26:00.000Z","updated_at":"2026-02-13T15:33:12.000Z","published_at":"2017-12-02T14:26:00.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven a rate of exchange calculate the equivalent units of 100 USD\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":44299,"title":"Vector Element Multiplication","description":"Take two incoming vectors, and output the element wise multiplication of the vectors.","description_html":"\u003cp\u003eTake two incoming vectors, and output the element wise multiplication of the vectors.\u003c/p\u003e","function_template":"function ele_mult_vec = your_fcn_name(x,y)\r\n  ele_mult_vec = ...;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 5];\r\ny = [1 2 3 4 5];\r\nele_mult_vec = [1 4 9 16 25];\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = ones(1,10);\r\ny = ones(1,10);\r\nele_mult_vec = ones(1,10);\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = ones(1,10);\r\ny = 10:10:100;\r\nele_mult_vec = 10:10:100;\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = 10:10:100;\r\ny = 0.1*ones(1,10);\r\nele_mult_vec = 1:10;\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = 1:3;\r\ny = 4:6;\r\nele_mult_vec = [4 10 18];\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n\r\n%%\r\nx = mod(1:100,2);\r\ny = mod([2:100,1],2);\r\nele_mult_vec = zeros(1,100);\r\nassert(isequal(your_fcn_name(x,y),ele_mult_vec))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":12852,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":124,"test_suite_updated_at":"2017-09-08T19:34:56.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-06T01:08:51.000Z","updated_at":"2026-02-11T18:34:27.000Z","published_at":"2017-09-06T01:08:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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 output the element wise multiplication of the vectors.\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":44329,"title":"Matrix multiplication","description":"Multiply two incoming matrices via matrix multiplication","description_html":"\u003cp\u003eMultiply two incoming matrices via matrix multiplication\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 = [     8     5;    20    13];\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":171,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-14T17:35:40.000Z","updated_at":"2026-02-11T18:28:55.000Z","published_at":"2017-09-14T17:35:40.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 incoming matrices via matrix multiplication\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":2928,"title":"Find the product of a Vector","description":"How would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 2?;\r\n\r\nx = [1 : 0.5 : 6];\r\n\r\ny = x;\r\n\r\n","description_html":"\u003cp\u003eHow would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 2?;\u003c/p\u003e\u003cp\u003ex = [1 : 0.5 : 6];\u003c/p\u003e\u003cp\u003ey = x;\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1:0.5:6];\r\ny_correct =  [2:12];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":34004,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":348,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-02-02T15:58:19.000Z","updated_at":"2026-02-10T21:50:52.000Z","published_at":"2015-02-02T15:58:19.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\u003eHow would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 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\u003ex = [1 : 0.5 : 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\u003ey = x;\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":2030,"title":"A Poker Hand","description":"Texas Hold ‘Em is a classical card game. In this problem, we are concerned with determining the probability of attaining a certain type of hand.\r\n\r\nA “Full House” is a five card hand comprised composed of two sets: a set of three of a kind, and a set of two of a kind. Examples include: K-K-K-Q-Q, 10-10-10-5-5, and A-A-A-4-4.\r\n\r\nAssuming that there are 52 cards in a unique, distinguishable deck, find the probability of attaining a “Full House” in any given hand. You may assume that there are 9 players playing on a full table.\r\n","description_html":"\u003cp\u003eTexas Hold ‘Em is a classical card game. In this problem, we are concerned with determining the probability of attaining a certain type of hand.\u003c/p\u003e\u003cp\u003eA “Full House” is a five card hand comprised composed of two sets: a set of three of a kind, and a set of two of a kind. Examples include: K-K-K-Q-Q, 10-10-10-5-5, and A-A-A-4-4.\u003c/p\u003e\u003cp\u003eAssuming that there are 52 cards in a unique, distinguishable deck, find the probability of attaining a “Full House” in any given hand. You may assume that there are 9 players playing on a full table.\u003c/p\u003e","function_template":"function y = fullHouse(x)\r\nx=52; %number of cards in a deck\r\n%siginificant to 7 digits (for luck)\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 0.0144058;\r\nassert(isequal(fullHouse(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":16441,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-12-02T07:52:42.000Z","updated_at":"2025-06-08T09:16:04.000Z","published_at":"2013-12-02T08:00:04.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eTexas Hold ‘Em is a classical card game. In this problem, we are concerned with determining the probability of attaining a certain type of hand.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA “Full House” is a five card hand comprised composed of two sets: a set of three of a kind, and a set of two of a kind. Examples include: K-K-K-Q-Q, 10-10-10-5-5, and A-A-A-4-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\u003eAssuming that there are 52 cards in a unique, distinguishable deck, find the probability of attaining a “Full House” in any given hand. You may assume that there are 9 players playing on a full table.\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":2161,"title":"Let's get back to school, and create multiplication tables","description":"For a given range, create multiplication tables. (start is always \u003c endno)\r\n\r\nExample\r\n\r\n start = 17\r\n endno = 19\r\n\r\nThen, \r\n\r\n table = \r\n  [ 17    18    19\r\n    34    36    38\r\n    51    54    57\r\n    68    72    76\r\n    85    90    95\r\n   102   108   114\r\n   119   126   133\r\n   136   144   152\r\n   153   162   171\r\n   170   180   190 ]\r\n","description_html":"\u003cp\u003eFor a given range, create multiplication tables. (start is always \u0026lt; endno)\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e start = 17\r\n endno = 19\u003c/pre\u003e\u003cp\u003eThen,\u003c/p\u003e\u003cpre\u003e table = \r\n  [ 17    18    19\r\n    34    36    38\r\n    51    54    57\r\n    68    72    76\r\n    85    90    95\r\n   102   108   114\r\n   119   126   133\r\n   136   144   152\r\n   153   162   171\r\n   170   180   190 ]\u003c/pre\u003e","function_template":"function table= Tables(start, endno)\r\n  table = [start:endno];\r\nend","test_suite":"%%\r\nstart = 1;\r\nendno = 10;\r\ny_correct = [1     2     3     4     5     6     7     8     9    10;\r\n     2     4     6     8    10    12    14    16    18    20;\r\n     3     6     9    12    15    18    21    24    27    30;\r\n     4     8    12    16    20    24    28    32    36    40;\r\n     5    10    15    20    25    30    35    40    45    50;\r\n     6    12    18    24    30    36    42    48    54    60;\r\n     7    14    21    28    35    42    49    56    63    70;\r\n     8    16    24    32    40    48    56    64    72    80;\r\n     9    18    27    36    45    54    63    72    81    90;\r\n    10    20    30    40    50    60    70    80    90   100;];\r\nassert(isequal(Tables(start, endno),y_correct))\r\n\r\n%%\r\nstart = 17;\r\nendno = 19;\r\ny_correct = [17    18    19;\r\n    34    36    38;\r\n    51    54    57;\r\n    68    72    76;\r\n    85    90    95;\r\n   102   108   114;\r\n   119   126   133;\r\n   136   144   152;\r\n   153   162   171;\r\n   170   180   190;];\r\nassert(isequal(Tables(start, endno),y_correct))\r\n\r\n%%\r\nstart = 21;\r\nendno = 22;\r\n\r\ny_correct =[21    22;\r\n    42    44;\r\n    63    66;\r\n    84    88;\r\n   105   110;\r\n   126   132;\r\n   147   154;\r\n   168   176;\r\n   189   198;\r\n   210   220;]\r\nassert(isequal(Tables(start, endno),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":240,"test_suite_updated_at":"2014-02-06T17:58:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-06T17:45:15.000Z","updated_at":"2026-04-03T02:41:10.000Z","published_at":"2014-02-06T17:49:12.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\u003eFor a given range, create multiplication tables. (start is always \u0026lt; endno)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ start = 17\\n endno = 19]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThen,\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[ table = \\n  [ 17    18    19\\n    34    36    38\\n    51    54    57\\n    68    72    76\\n    85    90    95\\n   102   108   114\\n   119   126   133\\n   136   144   152\\n   153   162   171\\n   170   180   190 ]]]\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":2381,"title":"Sum of digit range","description":"Example: \r\n\r\nIf A is n1, and B is n2 digit positive numbers. A*B's digit range will be [c d] (c = min \u0026 d = max). \r\nThen return c+d.","description_html":"\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003eIf A is n1, and B is n2 digit positive numbers. A*B's digit range will be [c d] (c = min \u0026 d = max). \r\nThen return c+d.\u003c/p\u003e","function_template":"function result = digitrange(n1,n2)\r\nresult = n1/n2;\r\nend","test_suite":"%%\r\nn1 = 758; n2 = 469;\r\ny_correct = 2453;\r\nassert(isequal(digitrange(n1,n2),y_correct))\r\n\r\n%%\r\nn1 = 6.23e4; n2 = 12;\r\ny_correct = 124623;\r\nassert(isequal(digitrange(n1,n2),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":5,"created_by":27005,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":48,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-06-21T14:10:26.000Z","updated_at":"2025-07-19T04:59:52.000Z","published_at":"2014-06-21T14:10:29.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\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf A is n1, and B is n2 digit positive numbers. A*B's digit range will be [c d] (c = min \u0026amp; d = max). Then return c+d.\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":2178,"title":"Matrix multiplication across rows","description":"Given matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix\r\n\r\nExample\r\n \r\n m = [ 1 2 3\r\n       4 5 6\r\n       7 8 9 ]\r\n\r\nThen\r\n\r\n n = [ 1   2    6\r\n       4  20  120\r\n       7  56  504 ]\r\n\r\n","description_html":"\u003cp\u003eGiven matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e m = [ 1 2 3\r\n       4 5 6\r\n       7 8 9 ]\u003c/pre\u003e\u003cp\u003eThen\u003c/p\u003e\u003cpre\u003e n = [ 1   2    6\r\n       4  20  120\r\n       7  56  504 ]\u003c/pre\u003e","function_template":"function y = MatMultiply(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx =[ 1 2 3; 4 5 6; 7 8 9];\r\ny_correct = [1 2 6;4 20 120; 7 56 504];\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n%%\r\nx =reshape([1:10], 2,5);\r\ny_correct =   [ 1  3  15  105  945;\r\n                2  8  48  384  3840;];\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n%%\r\nx =eye(5);\r\ny_correct =   [     1     0     0     0     0;\r\n                    0     0     0     0     0;\r\n                    0     0     0     0     0;\r\n                    0     0     0     0     0;\r\n                    0     0     0     0     0;];\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n%%\r\nx =ones(7);\r\ny_correct = ones(7);\r\nassert(isequal(MatMultiply(x),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":397,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":23,"created_at":"2014-02-12T21:23:36.000Z","updated_at":"2026-02-21T21:53:13.000Z","published_at":"2014-02-12T21:24:55.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 matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ m = [ 1 2 3\\n       4 5 6\\n       7 8 9 ]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThen\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[ n = [ 1   2    6\\n       4  20  120\\n       7  56  504 ]]]\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":336,"title":"Similar Triangles - find the height of the tree","description":"Given the height, h1, of a power pole, shorter than a tree, a given distance, x2 away, please find h2, height of the tree. Please note that the angle, phi, is the acute angle measured from the ground to an observer's line of sight aimed to the sucessive peaks of the power pole and the tree, in that order. Also the distance from the observer to the power pole is x1, also a given. x2 is the distance between the tree and the power pole. In all tests x1 is always a multiple of x2.\r\n\r\n\r\nInputs: h1, x1, x2\r\n\r\nOutput: h2\r\n\r\nHINT: find phi, given h1 and x1. Phi may be measured in degrees or radians. Note that default trig functions in MATLAB operate in radians.\r\n\r\nEX:\r\nx1 = 4;\r\nx2 = 4;\r\nh1 = 3;\r\n\r\n\u003e\u003eh2=findHeight(x1,x2,h1)\r\n\r\nh2=6\r\n\r\n\u003e\u003e","description_html":"\u003cp\u003eGiven the height, h1, of a power pole, shorter than a tree, a given distance, x2 away, please find h2, height of the tree. Please note that the angle, phi, is the acute angle measured from the ground to an observer's line of sight aimed to the sucessive peaks of the power pole and the tree, in that order. Also the distance from the observer to the power pole is x1, also a given. x2 is the distance between the tree and the power pole. In all tests x1 is always a multiple of x2.\u003c/p\u003e\u003cp\u003eInputs: h1, x1, x2\u003c/p\u003e\u003cp\u003eOutput: h2\u003c/p\u003e\u003cp\u003eHINT: find phi, given h1 and x1. Phi may be measured in degrees or radians. Note that default trig functions in MATLAB operate in radians.\u003c/p\u003e\u003cp\u003eEX:\r\nx1 = 4;\r\nx2 = 4;\r\nh1 = 3;\u003c/p\u003e\u003cp\u003e\u003e\u003eh2=findHeight(x1,x2,h1)\u003c/p\u003e\u003cp\u003eh2=6\u003c/p\u003e\u003cp\u003e\u003e\u003e\u003c/p\u003e","function_template":"function h2 = findHeight(x1,x2,h1)\r\n  h2 = heightoftree\r\nend","test_suite":"%%\r\nx1 = 4;\r\nx2 = 4;\r\nh1 = 3;\r\ny_correct = 6;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 8;\r\nh1 = 3;\r\ny_correct = 9;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 12;\r\nh1 = 3;\r\ny_correct = 12;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 16;\r\nh1 = 3;\r\ny_correct = 15;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 20;\r\nh1 = 3;\r\ny_correct = 18;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 24;\r\nh1 = 3;\r\ny_correct = 21;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 12;\r\nh1 = 5;\r\ny_correct = 20;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 4;\r\nx2 = 16;\r\nh1 = 10;\r\ny_correct = 50;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 2;\r\nx2 = 4;\r\nh1 = 5;\r\ny_correct = 15;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n%%\r\nx1 = 3;\r\nx2 = 6;\r\nh1 = 4;\r\ny_correct = 12;\r\nassert(isequal(findHeight(x1,x2,h1),y_correct))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":6,"created_by":1103,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":469,"test_suite_updated_at":"2012-02-18T04:42:47.000Z","rescore_all_solutions":false,"group_id":17,"created_at":"2012-02-17T22:52:21.000Z","updated_at":"2026-03-13T05:26:44.000Z","published_at":"2012-02-18T04:42:47.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 the height, h1, of a power pole, shorter than a tree, a given distance, x2 away, please find h2, height of the tree. Please note that the angle, phi, is the acute angle measured from the ground to an observer's line of sight aimed to the sucessive peaks of the power pole and the tree, in that order. Also the distance from the observer to the power pole is x1, also a given. x2 is the distance between the tree and the power pole. In all tests x1 is always a multiple of x2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInputs: h1, x1, x2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput: h2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHINT: find phi, given h1 and x1. Phi may be measured in degrees or radians. Note that default trig functions in MATLAB operate in radians.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEX: x1 = 4; x2 = 4; h1 = 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\u003e\u003eh2=findHeight(x1,x2,h1)\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\u003eh2=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\u003e\u003e\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":2157,"title":"Multiplication","description":"Multiply two numbers in a different manner.\r\nThe numbers are given to you as vectors x and y.\r\n\r\nExample\r\n\r\n x = [ 1 2 0 1 ]\r\n\r\n y = [ 8 5 1 ]\r\n\r\n      1  2  0  1\r\n X       8  5  1\r\n-------------------\r\n      1  2  0  1\r\n   5 10  0  5\r\n8 16  0  8\r\n----------------\r\n8 21 11 10  5  1 \r\n\r\n","description_html":"\u003cp\u003eMultiply two numbers in a different manner.\r\nThe numbers are given to you as vectors x and y.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e x = [ 1 2 0 1 ]\u003c/pre\u003e\u003cpre\u003e y = [ 8 5 1 ]\u003c/pre\u003e\u003cpre\u003e      1  2  0  1\r\n X       8  5  1\r\n-------------------\r\n      1  2  0  1\r\n   5 10  0  5\r\n8 16  0  8\r\n----------------\r\n8 21 11 10  5  1 \u003c/pre\u003e","function_template":"function result= muldif(x,y)\r\n  result = (x*y);\r\nend","test_suite":"%%\r\nx=[1 2];\r\ny=1;\r\ny_correct=[1 2];\r\nassert(isequal(muldif(x,y),y_correct));\r\n%%\r\nx=1;\r\ny=1;\r\ny_correct=1;\r\nassert(isequal(muldif(x,y),y_correct));\r\n%%\r\nx=[1 2 0 1];\r\ny=[8 5 1];\r\ny_correct = [8 21 11 10  5  1];\r\nassert(isequal(muldif(x,y),y_correct))\r\n%%\r\nx=[1 2 3 4 4 1 2 1 1 1];\r\ny=[1 2 3 4 5 6 9 10];\r\n y_correct=[1     4    10    20    34    49    68    90   104   109   101    73    43    40    25    19    10];\r\nassert(isequal(muldif(x,y),y_correct));\r\n%%\r\nx=[1:10 0 1];\r\ny=[8 5:1:25 1];\r\ny_correct = [8\t21\t40\t66\t100\t143\t196\t260\t336\t425\t440\t503\t555\t611\t667\t723\t779\t835\t891\t947\t1003\t1059\t1090\t1094\t1070\t1017\t934\t820\t674\t495\t282\t34\t25\t1\r\n];\r\nassert(isequal(muldif(x,y),y_correct))","published":true,"deleted":false,"likes_count":7,"comments_count":3,"created_by":22216,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":113,"test_suite_updated_at":"2014-02-06T11:37:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-06T09:07:12.000Z","updated_at":"2026-04-03T03:17:32.000Z","published_at":"2014-02-06T09:07:12.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\u003eMultiply two numbers in a different manner. The numbers are given to you as vectors 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=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [ 1 2 0 1 ]\\n\\n y = [ 8 5 1 ]\\n\\n      1  2  0  1\\n X       8  5  1\\n-------------------\\n      1  2  0  1\\n   5 10  0  5\\n8 16  0  8\\n----------------\\n8 21 11 10  5  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":813,"title":"Multiply 2 numbers ","description":"Very easy, you just have to multiply 2 numbers\r\nbut you cannot use the  following signs (*, /, - ,^) ,mtimes , times, cross, prod, cumprod , dec2bin, int2str and num2str functions. Will you take up the challenge?!\r\n\r\nExample :\r\nx= 3;\r\ny= 2;\r\n\r\noutput = 6 since 3*2 = 6 :)","description_html":"\u003cp\u003eVery easy, you just have to multiply 2 numbers\r\nbut you cannot use the  following signs (*, /, - ,^) ,mtimes , times, cross, prod, cumprod , dec2bin, int2str and num2str functions. Will you take up the challenge?!\u003c/p\u003e\u003cp\u003eExample :\r\nx= 3;\r\ny= 2;\u003c/p\u003e\u003cp\u003eoutput = 6 since 3*2 = 6 :)\u003c/p\u003e","function_template":"function output = your_fcn_name(x,y)\r\n  y = x*y;\r\nend","test_suite":"%%\r\nx = 1;\r\ny =2;\r\ny_correct = 2;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')),'sign * forbidden')\r\nassert(isempty(strfind(filetext, 'mtimes')),'mtimes forbidden')\r\nassert(isempty(strfind(filetext, 'cross')),'cross forbidden')\r\nassert(isempty(strfind(filetext, 'prod')),'prod forbidden')\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'mldivide')))\r\nassert(isempty(strfind(filetext, 'mrdivide')))\r\nassert(isempty(strfind(filetext, '/')),'/ forbidden')\r\nassert(isempty(strfind(filetext, '\\')))\r\nassert(isempty(strfind(filetext, '-')))\r\nassert(isempty(strfind(filetext, '^')),'^ forbidden')\r\nassert(isempty(strfind(filetext, 'dot')))\r\nassert(isempty(strfind(filetext, '''')),'string forbidden')\r\n\r\n%%\r\nx = 8;\r\ny =25;\r\ny_correct = 200;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n%%\r\nx = 8;\r\ny =0;\r\ny_correct = 0;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n\r\n%%\r\nx = -148;\r\ny =2865;\r\ny_correct = -424020;\r\nassert(isequal(round(your_fcn_name(x,y)),y_correct))\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n%% Test 5 : randi!!\r\nx = randi([1 58]);\r\ny =286.5;\r\ny_correct = x*y;\r\nassert(abs( your_fcn_name(x,y)-y_correct)\u003c1e-9)\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\n\r\n\r\n%% Test 6 : randi and pi !!\r\nx = randi([14 580]);\r\ny = -pi;\r\ny_correct = x*y;\r\nassert(abs( your_fcn_name(x,y)-y_correct)\u003c1e-9)\r\n\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, '*')))\r\nassert(isempty(strfind(filetext, 'mtimes')))\r\nassert(isempty(strfind(filetext, 'cross')))\r\nassert(isempty(strfind(filetext, 'prod')))\r\nassert(isempty(strfind(filetext, 'cumprod')))\r\nassert(isempty(strfind(filetext, 'times')))\r\nassert(isempty(strfind(filetext, 'dot')))\r\nassert(isempty(strfind(filetext, 'num2str')))\r\nassert(isempty(strfind(filetext, 'int2str')))\r\nassert(isempty(strfind(filetext, 'dec2bin')))\r\n","published":true,"deleted":false,"likes_count":21,"comments_count":4,"created_by":639,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":348,"test_suite_updated_at":"2012-07-10T12:45:28.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-07-04T09:34:18.000Z","updated_at":"2026-03-28T02:08:05.000Z","published_at":"2012-07-04T09:34:18.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\u003eVery easy, you just have to multiply 2 numbers but you cannot use the following signs (*, /, - ,^) ,mtimes , times, cross, prod, cumprod , dec2bin, int2str and num2str functions. Will you take up the challenge?!\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 : x= 3; y= 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\u003eoutput = 6 since 3*2 = 6 :)\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":44786,"title":"Lunar Arithmetic (Multiplication)","description":"\u003chttps://oeis.org/A087061 OEIS link for a description of lunar arithmetic\u003e\r\n\r\nSimply take the larger digit when adding and take the smaller digit when multiplying. \r\n\r\nExample \r\n\r\n        15866\r\n     X    147\r\n     _________\r\n        15766\r\n       14444\r\n    + 11111\r\n    __________\r\n      1145766","description_html":"\u003cp\u003e\u003ca href = \"https://oeis.org/A087061\"\u003eOEIS link for a description of lunar arithmetic\u003c/a\u003e\u003c/p\u003e\u003cp\u003eSimply take the larger digit when adding and take the smaller digit when multiplying.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e        15866\r\n     X    147\r\n     _________\r\n        15766\r\n       14444\r\n    + 11111\r\n    __________\r\n      1145766\u003c/pre\u003e","function_template":"function lunarMult = lunarMultiplication(x,y)\r\n  lunarMult = x * y\r\nend","test_suite":"\r\n\r\nfiletext = fileread('lunarMultiplication.m');\r\nassert(isempty(strfind(filetext, 'assert')))\r\nassert(isempty(strfind(filetext, 'echo')))\r\n\r\n%%\r\nx = 15866;\r\ny = 147;\r\nassert(isequal(lunarMultiplication(x,y),1145766))\r\n\r\n%%\r\nx = 169;\r\ny = 248;\r\nassert(isequal(lunarMultiplication(x,y),12468))\r\n\r\n%%\r\nx = 7;\r\ny = 4;\r\nassert(isequal(lunarMultiplication(x,y),4))\r\n\r\n\r\n%%\r\nx = 78;\r\ny = 4;\r\nassert(isequal(lunarMultiplication(x,y),44))\r\n\r\n\r\n%%\r\nx = 7799123;\r\ny = 109;\r\nassert(isequal(lunarMultiplication(x,y),117799123))","published":true,"deleted":false,"likes_count":5,"comments_count":0,"created_by":8703,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":49,"test_suite_updated_at":"2019-04-22T12:02:07.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-11-10T06:01:37.000Z","updated_at":"2026-03-20T13:37:48.000Z","published_at":"2018-11-10T06:01:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"https://oeis.org/A087061\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOEIS link for a description of lunar arithmetic\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eSimply take the larger digit when adding and take the smaller digit when multiplying.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[        15866\\n     X    147\\n     _________\\n        15766\\n       14444\\n    + 11111\\n    __________\\n      1145766]]\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":110,"title":"Make an N-dimensional Multiplication Table","description":"*INSTRUCTIONS*\r\n\r\nThis is a multi-dimensional variant of the normal multiplication table used to teach elementary students multiplication. In this variant, we are going to produce a table that multiplies the divisors 1 to _n_ (input) agains itself in _d_ dimensions.\r\n\r\n_Note_: Inputting _d_ = 0 should return the number 1 and _d_ = 1 should return a column vector with the elements 1 to _n_.\r\n\r\n\r\n*Example:*\r\n\r\nInput: \r\n\r\n  n = 3;\r\n  d = 3;\r\n\r\nOutput:\r\n\r\n  tt(:,:,1) = [ 1  2  3\r\n                2  4  6\r\n                3  6  9  ];\r\n  tt(:,:,2) = [ 2  4  6\r\n                4  8  12\r\n                6  12 18 ];\r\n  tt(:,:,3) = [ 3  6  9\r\n                6  12 18\r\n                9  18 27 ];","description_html":"\u003cp\u003e\u003cb\u003eINSTRUCTIONS\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is a multi-dimensional variant of the normal multiplication table used to teach elementary students multiplication. In this variant, we are going to produce a table that multiplies the divisors 1 to \u003ci\u003en\u003c/i\u003e (input) agains itself in \u003ci\u003ed\u003c/i\u003e dimensions.\u003c/p\u003e\u003cp\u003e\u003ci\u003eNote\u003c/i\u003e: Inputting \u003ci\u003ed\u003c/i\u003e = 0 should return the number 1 and \u003ci\u003ed\u003c/i\u003e = 1 should return a column vector with the elements 1 to \u003ci\u003en\u003c/i\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eInput:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003en = 3;\r\nd = 3;\r\n\u003c/pre\u003e\u003cp\u003eOutput:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ett(:,:,1) = [ 1  2  3\r\n              2  4  6\r\n              3  6  9  ];\r\ntt(:,:,2) = [ 2  4  6\r\n              4  8  12\r\n              6  12 18 ];\r\ntt(:,:,3) = [ 3  6  9\r\n              6  12 18\r\n              9  18 27 ];\r\n\u003c/pre\u003e","function_template":"function tt = ndtimestable(n,d)\r\n  tt = zeros(n*ones(1,d));\r\nend","test_suite":"%%\r\nm = 5;\r\nn = 0;\r\ntt = 1;\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 10;\r\nn = 1;\r\ntt = (1:10)';\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 12;\r\nn = 2;\r\ntt= [    1     2     3     4     5     6     7     8     9    10    11    12\r\n         2     4     6     8    10    12    14    16    18    20    22    24\r\n         3     6     9    12    15    18    21    24    27    30    33    36\r\n         4     8    12    16    20    24    28    32    36    40    44    48\r\n         5    10    15    20    25    30    35    40    45    50    55    60\r\n         6    12    18    24    30    36    42    48    54    60    66    72\r\n         7    14    21    28    35    42    49    56    63    70    77    84\r\n         8    16    24    32    40    48    56    64    72    80    88    96\r\n         9    18    27    36    45    54    63    72    81    90    99   108\r\n        10    20    30    40    50    60    70    80    90   100   110   120\r\n        11    22    33    44    55    66    77    88    99   110   121   132\r\n        12    24    36    48    60    72    84    96   108   120   132   144  ];\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 3;\r\nn = 3;\r\ntt = zeros(m,m,m);\r\ntt(:,:,1) = [ 1  2  3\r\n              2  4  6\r\n              3  6  9  ];\r\ntt(:,:,2) = [ 2  4  6\r\n              4  8  12\r\n              6  12 18 ];\r\ntt(:,:,3) = [ 3  6  9\r\n              6  12 18\r\n              9  18 27 ];\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 2;\r\nn = 4;\r\ntt = zeros(m,m,m,m);\r\ntt(:,:,1,1) = ...\r\n  [  1     2\r\n     2     4  ];\r\ntt(:,:,2,1) = ...\r\n  [  2     4\r\n     4     8  ];\r\ntt(:,:,1,2) = ...\r\n  [  2     4\r\n     4     8  ];\r\ntt(:,:,2,2) = ...\r\n  [  4     8\r\n     8    16  ];\r\nassert(isequal(ndtimestable(m,n),tt))\r\n\r\n%%\r\nm = 2;\r\nn = 7;\r\nassert(numel(ndtimestable(m,n)) == m^n);","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":141,"test_suite_updated_at":"2012-01-26T15:30:12.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-01-26T15:17:25.000Z","updated_at":"2026-04-03T03:18:48.000Z","published_at":"2012-01-26T15:30:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eINSTRUCTIONS\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 is a multi-dimensional variant of the normal multiplication table used to teach elementary students multiplication. In this variant, we are going to produce a table that multiplies the divisors 1 to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (input) agains itself in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e dimensions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNote\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: Inputting\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e = 0 should return the number 1 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:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ed\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e = 1 should return a column vector with the elements 1 to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput:\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[n = 3;\\nd = 3;]]\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\u003eOutput:\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[tt(:,:,1) = [ 1  2  3\\n              2  4  6\\n              3  6  9  ];\\ntt(:,:,2) = [ 2  4  6\\n              4  8  12\\n              6  12 18 ];\\ntt(:,:,3) = [ 3  6  9\\n              6  12 18\\n              9  18 27 ];]]\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":2237,"title":"Mmm! Multi-dimensional Matrix Multiplication ","description":"You have got a couple of multi-dimensional matrices, A and B. And want to multiply them. For the first 2 dimensions, an ordinary matrix multiplication applies. And in the other dimensions? Well, they just act as parallel worlds. All 2D matrices are multiplied, for every element in the other dimensions.\r\nYou may assume that the size in the 1st two dimensions allows simple matrix multiplication: A(:,:,1)*B(:,:,1), so size(A(:,:,1),2) == size(B(:,:,1),1), or either A(:,:,1) is a scalar or B(:,:,1) is a scalar.\r\nIn the other dimensions, the sizes of A and B should be eqaal, size(A,n) == size(B,n), for n\u003e2, or either ndims(A)\u003cn or ndims(B)\u003cn, or either size(A,n)==1 or size(B,n)==1, so one of them is a scalar.\r\n\r\nWrite a function |mtimesm| that does this, and ask Mathworks to include it in the |elmat| toolbox of the Next Release.","description_html":"\u003cp\u003eYou have got a couple of multi-dimensional matrices, A and B. And want to multiply them. For the first 2 dimensions, an ordinary matrix multiplication applies. And in the other dimensions? Well, they just act as parallel worlds. All 2D matrices are multiplied, for every element in the other dimensions.\r\nYou may assume that the size in the 1st two dimensions allows simple matrix multiplication: A(:,:,1)*B(:,:,1), so size(A(:,:,1),2) == size(B(:,:,1),1), or either A(:,:,1) is a scalar or B(:,:,1) is a scalar.\r\nIn the other dimensions, the sizes of A and B should be eqaal, size(A,n) == size(B,n), for n\u0026gt;2, or either ndims(A)\u0026lt;n or ndims(B)\u0026lt;n, or either size(A,n)==1 or size(B,n)==1, so one of them is a scalar.\u003c/p\u003e\u003cp\u003eWrite a function \u003ctt\u003emtimesm\u003c/tt\u003e that does this, and ask Mathworks to include it in the \u003ctt\u003eelmat\u003c/tt\u003e toolbox of the Next Release.\u003c/p\u003e","function_template":"function C = mtimesm(A,B)\r\n  C = A*B;\r\nend","test_suite":"%% case 1\r\nA = 1;\r\nB = 2;\r\nC = mtimesm(A,B);\r\nC_correct = 2;\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 2\r\nA = rand(2,3);\r\nB = rand(3,4);\r\nC = mtimesm(A,B);\r\nC_correct = A*B;\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 3\r\nA = rand(2,3);\r\nB = 2;\r\nC = mtimesm(A,B);\r\nC_correct = 2*A;\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 4\r\nA = rand(2,3,2);\r\nB = rand(3,4,2);\r\nC = mtimesm(A,B);\r\nC_correct = cat(3,A(:,:,1)*B(:,:,1),A(:,:,2)*B(:,:,2));\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 5\r\nA = rand(2,3,3);\r\nB = rand(3,4);\r\nC = mtimesm(A,B);\r\nC_correct = cat(3,A(:,:,1)*B,A(:,:,2)*B,A(:,:,3)*B); \r\nassert(isequal(C,C_correct))\r\n\r\n%% case 6\r\nA = rand(4,3,1,2);\r\nB = rand(3,2,2);\r\nC = mtimesm(A,B);\r\nC_correct(:,:,1,1) = A(:,:,1,1)*B(:,:,1);\r\nC_correct(:,:,1,2) = A(:,:,1,2)*B(:,:,1);\r\nC_correct(:,:,2,1) = A(:,:,1,1)*B(:,:,2);\r\nC_correct(:,:,2,2) = A(:,:,1,2)*B(:,:,2);\r\nassert(isequal(C,C_correct))\r\n\r\n%% case 7\r\nA = rand(4,3,1,2);\r\nB = rand(3,2,1,1,2);\r\nC = mtimesm(A,B);\r\nC_correct(:,:,1,1,1) = A(:,:,1,1)*B(:,:,1,1,1);\r\nC_correct(:,:,1,1,2) = A(:,:,1,1)*B(:,:,1,1,2);\r\nC_correct(:,:,1,2,1) = A(:,:,1,2)*B(:,:,1,1,1);\r\nC_correct(:,:,1,2,2) = A(:,:,1,2)*B(:,:,1,1,2);\r\nassert(isequal(C,C_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":5,"created_by":6556,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":"2014-03-07T06:22:58.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-03-06T11:17:42.000Z","updated_at":"2026-04-03T03:22:22.000Z","published_at":"2014-03-06T11:17:42.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou have got a couple of multi-dimensional matrices, A and B. And want to multiply them. For the first 2 dimensions, an ordinary matrix multiplication applies. And in the other dimensions? Well, they just act as parallel worlds. All 2D matrices are multiplied, for every element in the other dimensions. You may assume that the size in the 1st two dimensions allows simple matrix multiplication: A(:,:,1)*B(:,:,1), so size(A(:,:,1),2) == size(B(:,:,1),1), or either A(:,:,1) is a scalar or B(:,:,1) is a scalar. In the other dimensions, the sizes of A and B should be eqaal, size(A,n) == size(B,n), for n\u0026gt;2, or either ndims(A)\u0026lt;n or ndims(B)\u0026lt;n, or either size(A,n)==1 or size(B,n)==1, so one of them is a scalar.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function\u003c/w:t\u003e\u003c/w:r\u003e\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\u003emtimesm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that does this, and ask Mathworks to include it 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:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eelmat\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e toolbox of the Next Release.\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:\"multiplication\"","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:\"multiplication\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"multiplication\"","","\"","multiplication","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96ba0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fa2b6d96b00\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96240\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96e20\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2b6d96d80\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2b6d96ce0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2b6d96c40\u003e":"tag:\"multiplication\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96c40\u003e":"tag:\"multiplication\""},"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:\"multiplication\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"multiplication\"","","\"","multiplication","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96ba0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fa2b6d96b00\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96240\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96e20\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2b6d96d80\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2b6d96ce0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2b6d96c40\u003e":"tag:\"multiplication\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2b6d96c40\u003e":"tag:\"multiplication\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44546,"difficulty_rating":"easy"},{"id":44300,"difficulty_rating":"easy"},{"id":44425,"difficulty_rating":"easy"},{"id":44299,"difficulty_rating":"easy"},{"id":44329,"difficulty_rating":"easy"},{"id":2928,"difficulty_rating":"easy"},{"id":2030,"difficulty_rating":"easy"},{"id":2161,"difficulty_rating":"easy"},{"id":2381,"difficulty_rating":"easy-medium"},{"id":2178,"difficulty_rating":"easy-medium"},{"id":336,"difficulty_rating":"easy-medium"},{"id":2157,"difficulty_rating":"easy-medium"},{"id":813,"difficulty_rating":"easy-medium"},{"id":44786,"difficulty_rating":"medium"},{"id":110,"difficulty_rating":"medium"},{"id":2237,"difficulty_rating":"medium-hard"}]}}