{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.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":"2026-04-06T00: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":1879,"title":"Converting numbers back from extended form","description":"Thanks for all the help you guys gave me on writing out the numbers in extended form in \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1871-numbers-in-extended-form Problem 1871\u003e.  I got so good at it thanks to your help, now my teacher wants me to do the opposite.  She's going to give me the number in extended form, and she wants me to write it out normally.  In this case, the string '10000+200+30+4' would be the input, and the output would be the number 10234.\r\n\r\nFirst I expand the number, and then I contract it.  I wish she could just make up her mind!","description_html":"\u003cp\u003eThanks for all the help you guys gave me on writing out the numbers in extended form in \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1871-numbers-in-extended-form\"\u003eProblem 1871\u003c/a\u003e.  I got so good at it thanks to your help, now my teacher wants me to do the opposite.  She's going to give me the number in extended form, and she wants me to write it out normally.  In this case, the string '10000+200+30+4' would be the input, and the output would be the number 10234.\u003c/p\u003e\u003cp\u003eFirst I expand the number, and then I contract it.  I wish she could just make up her mind!\u003c/p\u003e","function_template":"function y = contracted_form(s)\r\n  y = s;\r\nend","test_suite":"y_correct = 8; x = '8'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 10234; x = '10000+200+30+4'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 987654321; x='900000000+80000000+7000000+600000+50000+4000+300+20+1';\r\nassert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 1000; x = '1000'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 314159265358979; x = '300000000000000+10000000000000+4000000000000+100000000000+50000000000+9000000000+200000000+60000000+5000000+300000+50000+8000+900+70+9'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 540200; x='500000+40000+200'; assert(isequal(contracted_form(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":129,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":38,"created_at":"2013-09-16T18:55:31.000Z","updated_at":"2026-03-31T17:48:22.000Z","published_at":"2013-09-16T18:57:24.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\u003eThanks for all the help you guys gave me on writing out the numbers in extended form in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1871-numbers-in-extended-form\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 1871\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. I got so good at it thanks to your help, now my teacher wants me to do the opposite. She's going to give me the number in extended form, and she wants me to write it out normally. In this case, the string '10000+200+30+4' would be the input, and the output would be the number 10234.\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\u003eFirst I expand the number, and then I contract it. I wish she could just make up her mind!\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":1871,"title":"Numbers in extended form","description":"Shhhhhhh.  Don't tell my daddy, but I'm borrowing his Cody account so all of you very smart people can help me out.  I just started third grade a couple of weeks ago, and my math teacher is having me write out numbers in \"extended form.\"  This means that you need to write out a bunch of zeros after each digit.  Adding all of those numbers together should give you the same number you started with.\r\n\r\nThe example she gave us all in class was that extended form of 10,234 is 10000+200+30+4, so you don't need to worry about writing out \"0000\" for the thousands place.  All the numbers will be positive, since we aren't supposed to know about negative numbers yet.  Thanks for your help, and please don't tell my daddy I know his Cody password!\r\n\r\n(Edit - My daughter's a very smart girl, but she forgot to mention that your output should be a string, and there should be no spaces around the plus signs.  There won't be any leading zeros in your input number either.)","description_html":"\u003cp\u003eShhhhhhh.  Don't tell my daddy, but I'm borrowing his Cody account so all of you very smart people can help me out.  I just started third grade a couple of weeks ago, and my math teacher is having me write out numbers in \"extended form.\"  This means that you need to write out a bunch of zeros after each digit.  Adding all of those numbers together should give you the same number you started with.\u003c/p\u003e\u003cp\u003eThe example she gave us all in class was that extended form of 10,234 is 10000+200+30+4, so you don't need to worry about writing out \"0000\" for the thousands place.  All the numbers will be positive, since we aren't supposed to know about negative numbers yet.  Thanks for your help, and please don't tell my daddy I know his Cody password!\u003c/p\u003e\u003cp\u003e(Edit - My daughter's a very smart girl, but she forgot to mention that your output should be a string, and there should be no spaces around the plus signs.  There won't be any leading zeros in your input number either.)\u003c/p\u003e","function_template":"function y = extended_form(x)\r\n  y = x;\r\nend","test_suite":"x = 8;\r\ny_correct = '8';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx = 10234;\r\ny_correct = '10000+200+30+4';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx=987654321;\r\ny_correct='900000000+80000000+7000000+600000+50000+4000+300+20+1';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx = 1000;\r\ny_correct = '1000';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx = 314159265358979;\r\ny_correct = '300000000000000+10000000000000+4000000000000+100000000000+50000000000+9000000000+200000000+60000000+5000000+300000+50000+8000+900+70+9';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx=540200;\r\ny_correct='500000+40000+200';\r\nassert(strcmp(extended_form(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":7,"comments_count":3,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":113,"test_suite_updated_at":"2013-09-16T18:47:49.000Z","rescore_all_solutions":false,"group_id":38,"created_at":"2013-09-12T12:47:45.000Z","updated_at":"2026-03-31T17:47:40.000Z","published_at":"2013-09-12T12:49:58.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\u003eShhhhhhh. Don't tell my daddy, but I'm borrowing his Cody account so all of you very smart people can help me out. I just started third grade a couple of weeks ago, and my math teacher is having me write out numbers in \\\"extended form.\\\" This means that you need to write out a bunch of zeros after each digit. Adding all of those numbers together should give you the same number you started with.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe example she gave us all in class was that extended form of 10,234 is 10000+200+30+4, so you don't need to worry about writing out \\\"0000\\\" for the thousands place. All the numbers will be positive, since we aren't supposed to know about negative numbers yet. Thanks for your help, and please don't tell my daddy I know his Cody password!\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(Edit - My daughter's a very smart girl, but she forgot to mention that your output should be a string, and there should be no spaces around the plus signs. There won't be any leading zeros in your input number either.)\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":1941,"title":"Lowest sum from a group of digits","description":"Hi there.  It's James's daughter here again, and my third grade math teacher is up to her old tricks.  This time, she's giving us an even number of digits between 0-9, and she wants us to come up with the smallest possible sum of two numbers that are the same length.\r\n\r\nFor example, if we're given [0 1 2 3], the smallest sum we can get using those numbers by adding two 2-digit numbers together is 33.  That's either 10+23 or 13+20.  We don't need to know what the two original numbers are, just what their sum is.  We also can't start any of our numbers with a zero, because that's cheating.\r\n\r\nYou guys did a great job with my earlier problems, and even taught my dad a few things about MATLAB!  I hope you can help me out with this one as well!","description_html":"\u003cp\u003eHi there.  It's James's daughter here again, and my third grade math teacher is up to her old tricks.  This time, she's giving us an even number of digits between 0-9, and she wants us to come up with the smallest possible sum of two numbers that are the same length.\u003c/p\u003e\u003cp\u003eFor example, if we're given [0 1 2 3], the smallest sum we can get using those numbers by adding two 2-digit numbers together is 33.  That's either 10+23 or 13+20.  We don't need to know what the two original numbers are, just what their sum is.  We also can't start any of our numbers with a zero, because that's cheating.\u003c/p\u003e\u003cp\u003eYou guys did a great job with my earlier problems, and even taught my dad a few things about MATLAB!  I hope you can help me out with this one as well!\u003c/p\u003e","function_template":"function y = lowest_number(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 0:3; y_correct = 33; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[1 2 3 7 8 9] ; y_correct = 417; \r\nassert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[7 8 9 7 8 9] ; y_correct = 1578; \r\nassert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx = 0:9; y_correct = 34047; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=7*[ones(1,5) zeros(1,7)]; y_correct=1400084; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[ones(1,8) zeros(1,10)]; y_correct=200000222; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx = [0:9 1:8]; y_correct = 225802467; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[randperm(10)-1 randperm(6)]; y_correct=22580247; assert(isequal(lowest_number(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":7,"comments_count":3,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-17T16:55:16.000Z","updated_at":"2025-12-07T10:12:33.000Z","published_at":"2013-10-17T16:55:16.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\u003eHi there. It's James's daughter here again, and my third grade math teacher is up to her old tricks. This time, she's giving us an even number of digits between 0-9, and she wants us to come up with the smallest possible sum of two numbers that are the same length.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, if we're given [0 1 2 3], the smallest sum we can get using those numbers by adding two 2-digit numbers together is 33. That's either 10+23 or 13+20. We don't need to know what the two original numbers are, just what their sum is. We also can't start any of our numbers with a zero, because that's cheating.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou guys did a great job with my earlier problems, and even taught my dad a few things about MATLAB! I hope you can help me out with this one as well!\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":1879,"title":"Converting numbers back from extended form","description":"Thanks for all the help you guys gave me on writing out the numbers in extended form in \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1871-numbers-in-extended-form Problem 1871\u003e.  I got so good at it thanks to your help, now my teacher wants me to do the opposite.  She's going to give me the number in extended form, and she wants me to write it out normally.  In this case, the string '10000+200+30+4' would be the input, and the output would be the number 10234.\r\n\r\nFirst I expand the number, and then I contract it.  I wish she could just make up her mind!","description_html":"\u003cp\u003eThanks for all the help you guys gave me on writing out the numbers in extended form in \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1871-numbers-in-extended-form\"\u003eProblem 1871\u003c/a\u003e.  I got so good at it thanks to your help, now my teacher wants me to do the opposite.  She's going to give me the number in extended form, and she wants me to write it out normally.  In this case, the string '10000+200+30+4' would be the input, and the output would be the number 10234.\u003c/p\u003e\u003cp\u003eFirst I expand the number, and then I contract it.  I wish she could just make up her mind!\u003c/p\u003e","function_template":"function y = contracted_form(s)\r\n  y = s;\r\nend","test_suite":"y_correct = 8; x = '8'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 10234; x = '10000+200+30+4'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 987654321; x='900000000+80000000+7000000+600000+50000+4000+300+20+1';\r\nassert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 1000; x = '1000'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 314159265358979; x = '300000000000000+10000000000000+4000000000000+100000000000+50000000000+9000000000+200000000+60000000+5000000+300000+50000+8000+900+70+9'; assert(isequal(contracted_form(x),y_correct))\r\n%%\r\ny_correct = 540200; x='500000+40000+200'; assert(isequal(contracted_form(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":129,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":38,"created_at":"2013-09-16T18:55:31.000Z","updated_at":"2026-03-31T17:48:22.000Z","published_at":"2013-09-16T18:57:24.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\u003eThanks for all the help you guys gave me on writing out the numbers in extended form in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1871-numbers-in-extended-form\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 1871\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. I got so good at it thanks to your help, now my teacher wants me to do the opposite. She's going to give me the number in extended form, and she wants me to write it out normally. In this case, the string '10000+200+30+4' would be the input, and the output would be the number 10234.\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\u003eFirst I expand the number, and then I contract it. I wish she could just make up her mind!\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":1871,"title":"Numbers in extended form","description":"Shhhhhhh.  Don't tell my daddy, but I'm borrowing his Cody account so all of you very smart people can help me out.  I just started third grade a couple of weeks ago, and my math teacher is having me write out numbers in \"extended form.\"  This means that you need to write out a bunch of zeros after each digit.  Adding all of those numbers together should give you the same number you started with.\r\n\r\nThe example she gave us all in class was that extended form of 10,234 is 10000+200+30+4, so you don't need to worry about writing out \"0000\" for the thousands place.  All the numbers will be positive, since we aren't supposed to know about negative numbers yet.  Thanks for your help, and please don't tell my daddy I know his Cody password!\r\n\r\n(Edit - My daughter's a very smart girl, but she forgot to mention that your output should be a string, and there should be no spaces around the plus signs.  There won't be any leading zeros in your input number either.)","description_html":"\u003cp\u003eShhhhhhh.  Don't tell my daddy, but I'm borrowing his Cody account so all of you very smart people can help me out.  I just started third grade a couple of weeks ago, and my math teacher is having me write out numbers in \"extended form.\"  This means that you need to write out a bunch of zeros after each digit.  Adding all of those numbers together should give you the same number you started with.\u003c/p\u003e\u003cp\u003eThe example she gave us all in class was that extended form of 10,234 is 10000+200+30+4, so you don't need to worry about writing out \"0000\" for the thousands place.  All the numbers will be positive, since we aren't supposed to know about negative numbers yet.  Thanks for your help, and please don't tell my daddy I know his Cody password!\u003c/p\u003e\u003cp\u003e(Edit - My daughter's a very smart girl, but she forgot to mention that your output should be a string, and there should be no spaces around the plus signs.  There won't be any leading zeros in your input number either.)\u003c/p\u003e","function_template":"function y = extended_form(x)\r\n  y = x;\r\nend","test_suite":"x = 8;\r\ny_correct = '8';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx = 10234;\r\ny_correct = '10000+200+30+4';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx=987654321;\r\ny_correct='900000000+80000000+7000000+600000+50000+4000+300+20+1';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx = 1000;\r\ny_correct = '1000';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx = 314159265358979;\r\ny_correct = '300000000000000+10000000000000+4000000000000+100000000000+50000000000+9000000000+200000000+60000000+5000000+300000+50000+8000+900+70+9';\r\nassert(strcmp(extended_form(x),y_correct))\r\n%%\r\nx=540200;\r\ny_correct='500000+40000+200';\r\nassert(strcmp(extended_form(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":7,"comments_count":3,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":113,"test_suite_updated_at":"2013-09-16T18:47:49.000Z","rescore_all_solutions":false,"group_id":38,"created_at":"2013-09-12T12:47:45.000Z","updated_at":"2026-03-31T17:47:40.000Z","published_at":"2013-09-12T12:49:58.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\u003eShhhhhhh. Don't tell my daddy, but I'm borrowing his Cody account so all of you very smart people can help me out. I just started third grade a couple of weeks ago, and my math teacher is having me write out numbers in \\\"extended form.\\\" This means that you need to write out a bunch of zeros after each digit. Adding all of those numbers together should give you the same number you started with.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe example she gave us all in class was that extended form of 10,234 is 10000+200+30+4, so you don't need to worry about writing out \\\"0000\\\" for the thousands place. All the numbers will be positive, since we aren't supposed to know about negative numbers yet. Thanks for your help, and please don't tell my daddy I know his Cody password!\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(Edit - My daughter's a very smart girl, but she forgot to mention that your output should be a string, and there should be no spaces around the plus signs. There won't be any leading zeros in your input number either.)\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":1941,"title":"Lowest sum from a group of digits","description":"Hi there.  It's James's daughter here again, and my third grade math teacher is up to her old tricks.  This time, she's giving us an even number of digits between 0-9, and she wants us to come up with the smallest possible sum of two numbers that are the same length.\r\n\r\nFor example, if we're given [0 1 2 3], the smallest sum we can get using those numbers by adding two 2-digit numbers together is 33.  That's either 10+23 or 13+20.  We don't need to know what the two original numbers are, just what their sum is.  We also can't start any of our numbers with a zero, because that's cheating.\r\n\r\nYou guys did a great job with my earlier problems, and even taught my dad a few things about MATLAB!  I hope you can help me out with this one as well!","description_html":"\u003cp\u003eHi there.  It's James's daughter here again, and my third grade math teacher is up to her old tricks.  This time, she's giving us an even number of digits between 0-9, and she wants us to come up with the smallest possible sum of two numbers that are the same length.\u003c/p\u003e\u003cp\u003eFor example, if we're given [0 1 2 3], the smallest sum we can get using those numbers by adding two 2-digit numbers together is 33.  That's either 10+23 or 13+20.  We don't need to know what the two original numbers are, just what their sum is.  We also can't start any of our numbers with a zero, because that's cheating.\u003c/p\u003e\u003cp\u003eYou guys did a great job with my earlier problems, and even taught my dad a few things about MATLAB!  I hope you can help me out with this one as well!\u003c/p\u003e","function_template":"function y = lowest_number(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 0:3; y_correct = 33; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[1 2 3 7 8 9] ; y_correct = 417; \r\nassert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[7 8 9 7 8 9] ; y_correct = 1578; \r\nassert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx = 0:9; y_correct = 34047; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=7*[ones(1,5) zeros(1,7)]; y_correct=1400084; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[ones(1,8) zeros(1,10)]; y_correct=200000222; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx = [0:9 1:8]; y_correct = 225802467; assert(isequal(lowest_number(x),y_correct))\r\n%%\r\nx=[randperm(10)-1 randperm(6)]; y_correct=22580247; assert(isequal(lowest_number(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":7,"comments_count":3,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":55,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-17T16:55:16.000Z","updated_at":"2025-12-07T10:12:33.000Z","published_at":"2013-10-17T16:55:16.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\u003eHi there. It's James's daughter here again, and my third grade math teacher is up to her old tricks. This time, she's giving us an even number of digits between 0-9, and she wants us to come up with the smallest possible sum of two numbers that are the same length.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, if we're given [0 1 2 3], the smallest sum we can get using those numbers by adding two 2-digit numbers together is 33. That's either 10+23 or 13+20. We don't need to know what the two original numbers are, just what their sum is. We also can't start any of our numbers with a zero, because that's cheating.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou guys did a great job with my earlier problems, and even taught my dad a few things about MATLAB! I hope you can help me out with this one as well!\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:\"third grade math\"","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:\"third grade math\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"third grade math\"","","\"","third grade math","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f6c85d748a0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f6c85d74800\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f6c85d73f40\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f6c85d74b20\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f6c85d74a80\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f6c85d749e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f6c85d74940\u003e":"tag:\"third grade math\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f6c85d74940\u003e":"tag:\"third grade math\""},"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":"cody-search","password":"78X075ddcV44","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:\"third grade math\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"third grade math\"","","\"","third grade math","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f6c85d748a0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f6c85d74800\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f6c85d73f40\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f6c85d74b20\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f6c85d74a80\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f6c85d749e0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f6c85d74940\u003e":"tag:\"third grade math\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f6c85d74940\u003e":"tag:\"third grade math\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":1879,"difficulty_rating":"easy-medium"},{"id":1871,"difficulty_rating":"easy-medium"},{"id":1941,"difficulty_rating":"medium"}]}}