{"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":1557,"title":"factor to number","description":"e.g. input number x=10 then it should produce y=25 or x=100 then y should be 2255. write a function or code to generate the same.","description_html":"\u003cp\u003ee.g. input number x=10 then it should produce y=25 or x=100 then y should be 2255. write a function or code to generate the same.\u003c/p\u003e","function_template":"function y = factor_to_number(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 10;\r\ny_correct =25;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 100;\r\ny_correct =2255;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 1000;\r\ny_correct =222555;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 10000;\r\ny_correct =22225555;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 20000;\r\ny_correct =222225555;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 20001;\r\ny_correct =359113;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":13514,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":67,"test_suite_updated_at":"2013-06-06T07:30:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-06-06T07:28:19.000Z","updated_at":"2025-12-16T03:44:04.000Z","published_at":"2013-06-06T07:30:44.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\u003ee.g. input number x=10 then it should produce y=25 or x=100 then y should be 2255. write a function or code to generate the same.\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":1532,"title":"SLP Calculation","description":"The SLP Calculation Challenge is to implement SLP sequences and output the result as a string. SLP, Straight Line Program, creates a value based upon two pointers of prior values and one of the operators [ + - * ]. The first value in the sequence is 1 and is assigned pointer 0 (zero based indexing).\r\n\r\n*Input:* SLP_sequence (string)\r\n\r\n*Output:* SLP_value (string)\r\n\r\n*Example:*\r\n\r\n*Input:*\r\nSLP_sequence='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\r\n\r\nProduces:( Index 0 is 1 )\r\n\r\n2, 4, 16, 18, 288, 272, 273, 576, 78624, 79200, 6227020800\r\n\r\n*Output:*\r\n'6227020800' \r\n\r\nThe complexity to this Challenge is some solutions will exceed 2^64 and have eps\u003e1.\r\n\r\nPrior to viewing the link: What number is 2568 digits long and has 249 trailing zeros?\r\n\r\n\u003chttp://www.azspcs.net/ Al's Contests\u003e\r\n\r\n\r\n\r\n\r\n ","description_html":"\u003cp\u003eThe SLP Calculation Challenge is to implement SLP sequences and output the result as a string. SLP, Straight Line Program, creates a value based upon two pointers of prior values and one of the operators [ + - * ]. The first value in the sequence is 1 and is assigned pointer 0 (zero based indexing).\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e SLP_sequence (string)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e SLP_value (string)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e\r\nSLP_sequence='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\u003c/p\u003e\u003cp\u003eProduces:( Index 0 is 1 )\u003c/p\u003e\u003cp\u003e2, 4, 16, 18, 288, 272, 273, 576, 78624, 79200, 6227020800\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e\r\n'6227020800'\u003c/p\u003e\u003cp\u003eThe complexity to this Challenge is some solutions will exceed 2^64 and have eps\u003e1.\u003c/p\u003e\u003cp\u003ePrior to viewing the link: What number is 2568 digits long and has 249 trailing zeros?\u003c/p\u003e\u003cp\u003e\u003ca href = \"http://www.azspcs.net/\"\u003eAl's Contests\u003c/a\u003e\u003c/p\u003e","function_template":"function SLP = SLP_calc(SLP_str)\r\n  SLP = '0';\r\nend","test_suite":"SLP_str='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\r\n\r\nSLP = SLP_calc(SLP_str);\r\nSLP_exp='6227020800';\r\n\r\nassert(strcmp(SLP,SLP_exp),sprintf('%s\\n',SLP));\r\n%%\r\nSLP_str='0+0,1*1,1+2,3*3,3*4,5-3,6-4,2+5,8+2,5*6,8*9,7*11,8*10,13+10,8+14,2*13,12*15,14*16,17*18,18*19';\r\n\r\nSLP = SLP_calc(SLP_str);\r\nSLP_exp='13763753091226345046315979581580902400000000';\r\n\r\nassert(strcmp(SLP,SLP_exp),sprintf('%s\\n',SLP));\r\n%%\r\nSLP_str='0+0, 1+1, 2*2, 3-1, 3+4, 5+1, 5+4, 7+3, 8+6, 9+2, 4*4, 11+5, 8*4, 13+0, 14-12, 15+5, 8*5, 17-3, 10*9, 13*10, 15*15, 21-2, 22-19, 23-4, 21+16, 25+3, 16*16, 27-11, 28-2, 27-7, 30+2, 29+11, 32-19, 13*13, 34-2, 35-19, 27+29, 17*17, 38-2, 39-19, 39-10, 41-7, 38+2, 20*7, 44-27, 44+11, 44+35, 20*10, 48-47, 48+30, 50-40, 51-3, 50+27, 44*2, 54-35, 55-37, 55-13, 57-48, 55+9, 59-35, 60+11, 61-44, 62-53, 61+15, 60+13, 59+19, 66-62, 67-21, 52-68, 68+5, 54-24, 71-46, 59+24, 73+19, 74-26, 61+45, 66+61, 77-41, 78-63, 77-22, 80+28, 80+50, 82-13, 83+35, 84-60, 85-64, 81-86, 85+43, 88+39, 77+64, 35*36, 91+54, 92-44, 92+37, 93*91, 95*92, 93+48, 96*97, 39*40, 99-93, 99+54, 101-44, 102*99, 103*101, 102+48, 104*105, 22*23, 106*107, 107+54, 109-44, 108*110, 111*109, 110+48, 113-1, 112*113, 32*33, 115*116, 116+54, 118-114, 118-44, 117*120, 121*118, 120+48, 122*123, 124*94, 125*119, 126*30, 127*28, 98*46, 128*100, 57*31, 131*56, 130*60, 132*58, 129*61, 133*64, 134*62, 53*41, 136*51, 137*63, 135*52, 138*24, 139*71, 141*73, 144*72, 143*67, 146*68, 65*70, 147*80, 78*59, 145*90, 140*82, 142*83, 149*84, 86*37, 154*88, 148*89, 153*25, 151*26, 156*76, 75*42, 160*49, 162*87, 152*69, 163*79, 157*18, 81-52, 167+6, 164*15, 165*5, 30-15, 171-3, 150*172, 43+31, 66+59, 175+14, 176*174, 30-25, 166*178, 35-23, 180-17, 181*20, 82-33, 183*12, 60-30, 184*185, 71-40, 187*39, 188*7, 33-18, 44*190, 186*182, 192*168, 179*182, 193*177, 194*155, 169*168, 196*161, 195*173, 197*155, 198*158, 159*177, 202*161, 203*200, 170*173, 205*158, 206*200, 191*34, 208*208, 209*189, 210*210, 211*199, 212*212, 213*201, 214*214, 215*204, 216*216, 217*207';\r\n\r\ntic\r\nSLP = SLP_calc(SLP_str);\r\ntoc\r\nSLP_exp='402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\r\n\r\nassert(strcmp(SLP,SLP_exp),sprintf('%s\\n',SLP));\r\n\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-06-01T21:37:49.000Z","updated_at":"2013-06-01T22:56:28.000Z","published_at":"2013-06-01T22:56:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe SLP Calculation Challenge is to implement SLP sequences and output the result as a string. SLP, Straight Line Program, creates a value based upon two pointers of prior values and one of the operators [ + - * ]. The first value in the sequence is 1 and is assigned pointer 0 (zero based indexing).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e SLP_sequence (string)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e SLP_value (string)\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e SLP_sequence='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\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\u003eProduces:( Index 0 is 1 )\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2, 4, 16, 18, 288, 272, 273, 576, 78624, 79200, 6227020800\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e '6227020800'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe complexity to this Challenge is some solutions will exceed 2^64 and have eps\u0026gt;1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrior to viewing the link: What number is 2568 digits long and has 249 trailing zeros?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.azspcs.net/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAl's Contests\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45411,"title":"Compute the missing quantity among P, V, T for an ideal gas","description":"Consider 100 mol of helium gas at a certain pressure (P), volume (V), and temperature (T). Assuming that the ideal gas law applies, can you compute one of the 3 quantities given the other two?\r\n\r\nRecall that, with SI units, the ideal gas law is given by:\r\n\r\n  P x V = n x R x T\r\n    where:\r\n    P = pressure [Pa] or [kg/m/s^2]\r\n    V = volume [m^3]\r\n    n = number of moles [mol]\r\n    R = gas constant, 8.314 [J/mol/K] or [kg.m^2/K/mol/s^2]\r\n    T = temperature [K]\r\n\r\nWrite a function that takes a MATLAB variable, x, which is always a 3-element row vector containing the values of P, V, T in that order. However, exactly one of these values will be NaN, which you must solve using the ideal gas law equation above, given the other two values. All inputs are given in SI units, hence, you can use the given value of |R| above. Note that |n| = 100 mol. You are ensured that P, V, and/or T are floating-point numbers with 2 decimal places that satisfy the following constraints:\r\n\r\n* 1 x 10^5 \u003c= P \u003c= 3 x 10^5\r\n* 1 \u003c= V \u003c= 10\r\n* 300 \u003c= T \u003c= 500\r\n\r\nOutput the value of the missing quantity rounded to 2 decimal places, followed by a space, and then the correct units, either |Pa|, |m^3|, or |K|. For this, you can use |sprintf|. See sample test cases:\r\n\r\n  \u003e\u003e idealgas([233424.06 NaN 435.02])\r\nans =\r\n    '1.55 m^3'\r\n\u003e\u003e idealgas([109238.31 2.76 NaN])\r\nans =\r\n    '362.64 K'\r\n\u003e\u003e idealgas([NaN 1.19 411.97])\r\nans =\r\n    '287825.09 Pa'\r\n","description_html":"\u003cp\u003eConsider 100 mol of helium gas at a certain pressure (P), volume (V), and temperature (T). Assuming that the ideal gas law applies, can you compute one of the 3 quantities given the other two?\u003c/p\u003e\u003cp\u003eRecall that, with SI units, the ideal gas law is given by:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eP x V = n x R x T\r\n  where:\r\n  P = pressure [Pa] or [kg/m/s^2]\r\n  V = volume [m^3]\r\n  n = number of moles [mol]\r\n  R = gas constant, 8.314 [J/mol/K] or [kg.m^2/K/mol/s^2]\r\n  T = temperature [K]\r\n\u003c/pre\u003e\u003cp\u003eWrite a function that takes a MATLAB variable, x, which is always a 3-element row vector containing the values of P, V, T in that order. However, exactly one of these values will be NaN, which you must solve using the ideal gas law equation above, given the other two values. All inputs are given in SI units, hence, you can use the given value of \u003ctt\u003eR\u003c/tt\u003e above. Note that \u003ctt\u003en\u003c/tt\u003e = 100 mol. You are ensured that P, V, and/or T are floating-point numbers with 2 decimal places that satisfy the following constraints:\u003c/p\u003e\u003cul\u003e\u003cli\u003e1 x 10^5 \u0026lt;= P \u0026lt;= 3 x 10^5\u003c/li\u003e\u003cli\u003e1 \u0026lt;= V \u0026lt;= 10\u003c/li\u003e\u003cli\u003e300 \u0026lt;= T \u0026lt;= 500\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eOutput the value of the missing quantity rounded to 2 decimal places, followed by a space, and then the correct units, either \u003ctt\u003ePa\u003c/tt\u003e, \u003ctt\u003em^3\u003c/tt\u003e, or \u003ctt\u003eK\u003c/tt\u003e. For this, you can use \u003ctt\u003esprintf\u003c/tt\u003e. See sample test cases:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e\u0026gt;\u0026gt; idealgas([233424.06 NaN 435.02])\r\nans =\r\n  '1.55 m^3'\r\n\u0026gt;\u0026gt; idealgas([109238.31 2.76 NaN])\r\nans =\r\n  '362.64 K'\r\n\u0026gt;\u0026gt; idealgas([NaN 1.19 411.97])\r\nans =\r\n  '287825.09 Pa'\r\n\u003c/pre\u003e","function_template":"function y = idealgas(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(idealgas([233424.06 NaN 435.02]),'1.55 m^3'))\r\n%%\r\nassert(isequal(idealgas([294119.71 NaN 317.25]),'0.90 m^3'))\r\n%%\r\nassert(isequal(idealgas([173530.58 2.85 NaN]),'594.85 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.49 410.36]),'75985.15 Pa'))\r\n%%\r\nassert(isequal(idealgas([228388.12 5.36 NaN]),'1472.41 K'))\r\n%%\r\nassert(isequal(idealgas([120121.26 NaN 347.47]),'2.40 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.65 320.97]),'57388.06 Pa'))\r\n%%\r\nassert(isequal(idealgas([256885.58 3.62 NaN]),'1118.51 K'))\r\n%%\r\nassert(isequal(idealgas([186497.00 NaN 451.62]),'2.01 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.99 486.75]),'203358.77 Pa'))\r\n%%\r\nassert(isequal(idealgas([153235.77 8.18 NaN]),'1507.66 K'))\r\n%%\r\nassert(isequal(idealgas([179201.35 3.46 NaN]),'745.77 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 5.07 421.97]),'69196.42 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.95 439.29]),'45940.34 Pa'))\r\n%%\r\nassert(isequal(idealgas([126030.29 NaN 301.56]),'1.99 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.51 406.24]),'44973.09 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.14 326.86]),'126986.64 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.51 339.25]),'112371.49 Pa'))\r\n%%\r\nassert(isequal(idealgas([163285.80 2.96 NaN]),'581.34 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 6.00 336.89]),'46681.72 Pa'))\r\n%%\r\nassert(isequal(idealgas([115469.36 NaN 441.34]),'3.18 m^3'))\r\n%%\r\nassert(isequal(idealgas([162685.80 2.50 NaN]),'489.19 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 3.32 379.36]),'94999.97 Pa'))\r\n%%\r\nassert(isequal(idealgas([236819.21 NaN 496.57]),'1.74 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.39 376.27]),'130891.58 Pa'))\r\n%%\r\nassert(isequal(idealgas([251622.49 8.84 NaN]),'2675.42 K'))\r\n%%\r\nassert(isequal(idealgas([158829.73 NaN 466.48]),'2.44 m^3'))\r\n%%\r\nassert(isequal(idealgas([167062.27 NaN 390.52]),'1.94 m^3'))\r\n%%\r\nassert(isequal(idealgas([171921.26 NaN 448.51]),'2.17 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.12 304.89]),'119568.65 Pa'))\r\n%%\r\nassert(isequal(idealgas([163504.12 6.88 NaN]),'1353.03 K'))\r\n%%\r\nassert(isequal(idealgas([191577.27 3.16 NaN]),'728.15 K'))\r\n%%\r\nassert(isequal(idealgas([248129.61 7.69 NaN]),'2295.06 K'))\r\n%%\r\nassert(isequal(idealgas([192652.12 2.91 NaN]),'674.31 K'))\r\n%%\r\nassert(isequal(idealgas([135001.95 2.47 NaN]),'401.08 K'))\r\n%%\r\nassert(isequal(idealgas([203311.64 7.32 NaN]),'1790.04 K'))\r\n%%\r\nassert(isequal(idealgas([208176.82 7.12 NaN]),'1782.80 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.08 405.01]),'161887.17 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.59 383.02]),'69377.52 Pa'))\r\n%%\r\nassert(isequal(idealgas([151077.35 NaN 484.74]),'2.67 m^3'))\r\n%%\r\nassert(isequal(idealgas([286522.71 2.47 NaN]),'851.23 K'))\r\n%%\r\nassert(isequal(idealgas([215478.84 4.96 NaN]),'1285.51 K'))\r\n%%\r\nassert(isequal(idealgas([145733.90 1.58 NaN]),'276.95 K'))\r\n%%\r\nassert(isequal(idealgas([243042.50 NaN 383.81]),'1.31 m^3'))\r\n%%\r\nassert(isequal(idealgas([263228.02 3.86 NaN]),'1222.11 K'))\r\n%%\r\nassert(isequal(idealgas([270452.78 5.55 NaN]),'1805.40 K'))\r\n%%\r\nassert(isequal(idealgas([188792.83 NaN 473.35]),'2.08 m^3'))\r\n%%\r\nassert(isequal(idealgas([171014.73 NaN 344.83]),'1.68 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.49 328.44]),'60816.26 Pa'))\r\n%%\r\nassert(isequal(idealgas([184222.45 NaN 445.16]),'2.01 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.61 414.21]),'45252.85 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 3.39 484.92]),'118926.99 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.79 428.02]),'198802.14 Pa'))\r\n%%\r\nassert(isequal(idealgas([109010.22 NaN 369.49]),'2.82 m^3'))\r\n%%\r\nassert(isequal(idealgas([176773.72 6.65 NaN]),'1413.93 K'))\r\n%%\r\nassert(isequal(idealgas([260111.73 NaN 462.62]),'1.48 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 6.18 406.01]),'54620.83 Pa'))\r\n%%\r\nassert(isequal(idealgas([149725.79 5.06 NaN]),'911.25 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.27 407.13]),'266525.89 Pa'))\r\n%%\r\nassert(isequal(idealgas([260418.29 9.90 NaN]),'3100.96 K'))\r\n%%\r\nassert(isequal(idealgas([103635.51 NaN 456.75]),'3.66 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 9.09 425.19]),'38889.22 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.64 308.36]),'97110.04 Pa'))\r\n%%\r\nassert(isequal(idealgas([223288.70 NaN 370.89]),'1.38 m^3'))\r\n%%\r\nassert(isequal(idealgas([296869.88 9.51 NaN]),'3395.76 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.03 432.48]),'89221.80 Pa'))\r\n%%\r\nassert(isequal(idealgas([159101.45 NaN 405.57]),'2.12 m^3'))\r\n%%\r\nassert(isequal(idealgas([220527.64 NaN 416.71]),'1.57 m^3'))\r\n%%\r\nassert(isequal(idealgas([216714.12 5.61 NaN]),'1462.31 K'))\r\n%%\r\nassert(isequal(idealgas([299231.22 NaN 494.25]),'1.37 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 5.09 382.69]),'62508.54 Pa'))\r\n%%\r\nassert(isequal(idealgas([125130.92 3.78 NaN]),'568.91 K'))\r\n%%\r\nassert(isequal(idealgas([238757.52 1.09 NaN]),'313.02 K'))\r\n%%\r\nassert(isequal(idealgas([254190.84 1.38 NaN]),'421.92 K'))\r\n%%\r\nassert(isequal(idealgas([245902.61 3.02 NaN]),'893.22 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 6.61 347.29]),'43681.83 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.90 486.90]),'51241.60 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.89 397.95]),'175055.89 Pa'))\r\n%%\r\nassert(isequal(idealgas([279178.31 NaN 308.83]),'0.92 m^3'))\r\n%%\r\nassert(isequal(idealgas([254499.01 NaN 335.80]),'1.10 m^3'))\r\n%%\r\nassert(isequal(idealgas([142029.13 NaN 481.27]),'2.82 m^3'))\r\n%%\r\nassert(isequal(idealgas([120306.78 NaN 310.92]),'2.15 m^3'))\r\n%%\r\nassert(isequal(idealgas([186344.23 NaN 462.32]),'2.06 m^3'))\r\n%%\r\nassert(isequal(idealgas([278889.55 2.24 NaN]),'751.40 K'))\r\n%%\r\nassert(isequal(idealgas([283498.77 NaN 423.67]),'1.24 m^3'))\r\n%%\r\nassert(isequal(idealgas([287205.47 NaN 446.12]),'1.29 m^3'))\r\n%%\r\nassert(isequal(idealgas([266630.40 4.58 NaN]),'1468.81 K'))\r\n%%\r\nassert(isequal(idealgas([164492.08 NaN 495.83]),'2.51 m^3'))\r\n%%\r\nassert(isequal(idealgas([166084.72 6.58 NaN]),'1314.45 K'))\r\n%%\r\nassert(isequal(idealgas([182780.15 5.43 NaN]),'1193.76 K'))\r\n%%\r\nassert(isequal(idealgas([165550.99 8.54 NaN]),'1700.51 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.21 432.53]),'85416.97 Pa'))\r\n%%\r\nassert(isequal(idealgas([146076.61 NaN 424.91]),'2.42 m^3'))\r\n%%\r\nassert(isequal(idealgas([232087.59 NaN 369.76]),'1.32 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.44 471.24]),'52659.80 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.24 467.34]),'173458.25 Pa'))\r\n%%\r\nassert(isequal(idealgas([217641.88 NaN 461.35]),'1.76 m^3'))\r\n%%\r\nassert(isequal(idealgas([197918.87 NaN 370.63]),'1.56 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.38 494.59]),'297972.56 Pa'))\r\n","published":true,"deleted":false,"likes_count":9,"comments_count":0,"created_by":255320,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":189,"test_suite_updated_at":"2020-03-31T14:35:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-31T13:58:54.000Z","updated_at":"2026-03-19T20:10:53.000Z","published_at":"2020-03-31T14:35:13.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsider 100 mol of helium gas at a certain pressure (P), volume (V), and temperature (T). Assuming that the ideal gas law applies, can you compute one of the 3 quantities given the other two?\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\u003eRecall that, with SI units, the ideal gas law is given by:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[P x V = n x R x T\\n  where:\\n  P = pressure [Pa] or [kg/m/s^2]\\n  V = volume [m^3]\\n  n = number of moles [mol]\\n  R = gas constant, 8.314 [J/mol/K] or [kg.m^2/K/mol/s^2]\\n  T = temperature [K]]]\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\u003eWrite a function that takes a MATLAB variable, x, which is always a 3-element row vector containing the values of P, V, T in that order. However, exactly one of these values will be NaN, which you must solve using the ideal gas law equation above, given the other two values. All inputs are given in SI units, hence, you can use the given value of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eR\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e above. Note that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e = 100 mol. You are ensured that P, V, and/or T are floating-point numbers with 2 decimal places that satisfy the following constraints:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 x 10^5 \u0026lt;= P \u0026lt;= 3 x 10^5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 \u0026lt;= V \u0026lt;= 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e300 \u0026lt;= T \u0026lt;= 500\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 the value of the missing quantity rounded to 2 decimal places, followed by a space, and then the correct units, either\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\u003ePa\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em^3\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, or\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\u003eK\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. For this, you can use\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\u003esprintf\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. See sample test cases:\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[\u003e\u003e idealgas([233424.06 NaN 435.02])\\nans =\\n  '1.55 m^3'\\n\u003e\u003e idealgas([109238.31 2.76 NaN])\\nans =\\n  '362.64 K'\\n\u003e\u003e idealgas([NaN 1.19 411.97])\\nans =\\n  '287825.09 Pa']]\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":1915,"title":"GJam 2013 Veterans: Baby Height Prediction","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p1 GJam 2013 Veterans Baby Height\u003e. Only the first 82 of 5958 test cases are evaluated.\r\n\r\nThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\r\n\r\n\r\n*Input:* str , String of Sex, Mom and Dad Height x'y\"\r\n\r\n*Output:* H , string of Predicted Height Range\r\n\r\n*Examples:* [str] [H]\r\n\r\n  B 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\n  G 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\n  B 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n  \r\n\r\n*Commentary:*\r\n\r\n  1) Provide input like fgetl per test case\r\n  2) 15 of 32 entrants completed this Challenge\r\n  3) This is a test of regexp and sprintf formatting (or just regexprep)","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p1\"\u003eGJam 2013 Veterans Baby Height\u003c/a\u003e. Only the first 82 of 5958 test cases are evaluated.\u003c/p\u003e\u003cp\u003eThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e str , String of Sex, Mom and Dad Height x'y\"\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e H , string of Predicted Height Range\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [str] [H]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eB 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\nG 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\nB 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Provide input like fgetl per test case\r\n2) 15 of 32 entrants completed this Challenge\r\n3) This is a test of regexp and sprintf formatting (or just regexprep)\r\n\u003c/pre\u003e","function_template":"function [H]=BabyH_V(str)\r\n H='';\r\n v= regexp(str,'[''''\"\\s]','split');\r\nend","test_suite":"%%\r\ntic\r\nvstr='G 7''4\" 9''11\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''1\" 4''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''3\" 2''9\"';\r\nvexp='3''5\" to 4''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''10\" 4''4\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''0\" 9''7\"';\r\nvexp='7''3\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''5\" 4''8\"';\r\nvexp='3''6\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''3\" 7''9\"';\r\nvexp='7''6\" to 8''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''7\" 8''0\"';\r\nvexp='8''2\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''10\" 1''3\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''9\" 1''5\"';\r\nvexp='1''7\" to 2''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 8''9\"';\r\nvexp='7''4\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''7\" 9''3\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''2\" 7''11\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''0\" 3''9\"';\r\nvexp='2''10\" to 3''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 3''3\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''6\" 1''4\"';\r\nvexp='1''5\" to 2''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''8\" 8''7\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''11\" 7''3\"';\r\nvexp='8''1\" to 8''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''0\" 1''2\"';\r\nvexp='4''7\" to 5''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''0\" 1''2\"';\r\nvexp='3''7\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 5''7\"';\r\nvexp='5''5\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 6''1\"';\r\nvexp='4''10\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''7\" 2''3\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 6''7\"';\r\nvexp='6''7\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 6''5\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''3\" 4''11\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''0\" 5''6\"';\r\nvexp='3''3\" to 3''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''7\" 6''8\"';\r\nvexp='3''7\" to 4''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 5''11\"';\r\nvexp='4''0\" to 4''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 3''6\"';\r\nvexp='2''9\" to 3''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''10\" 1''9\"';\r\nvexp='5''8\" to 6''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 5''11\"';\r\nvexp='4''8\" to 5''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 1''2\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 3''7\" 9''1\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 9''11\"';\r\nvexp='7''10\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''10\" 8''10\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 7''4\"';\r\nvexp='6''7\" to 7''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''9\" 4''8\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''8\" 6''3\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 8''4\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''7\" 9''6\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''7\" 7''1\"';\r\nvexp='4''4\" to 4''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''1\" 7''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''5\" 8''7\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''0\" 1''0\"';\r\nvexp='2''0\" to 2''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''4\" 7''1\"';\r\nvexp='5''7\" to 6''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''1\" 8''1\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 7''8\"';\r\nvexp='6''0\" to 6''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 8''2\"';\r\nvexp='7''4\" to 8''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''6\" 5''1\"';\r\nvexp='3''9\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 6''9\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 5''8\"';\r\nvexp='5''6\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''4\" 2''10\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''7\" 9''5\"';\r\nvexp='7''11\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''6\" 5''7\"';\r\nvexp='6''5\" to 7''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 8''10\"';\r\nvexp='7''9\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 3''2\"';\r\nvexp='4''3\" to 4''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''3\" 8''3\"';\r\nvexp='8''3\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''7\" 1''4\"';\r\nvexp='2''11\" to 3''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''2\" 2''4\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''2\" 5''8\"';\r\nvexp='6''11\" to 7''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''4\" 5''5\"';\r\nvexp='5''9\" to 6''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 7''7\"';\r\nvexp='8''5\" to 9''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 1''2\"';\r\nvexp='2''4\" to 2''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''10\" 3''7\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''10\" 2''8\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''5\" 4''3\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''1\" 3''0\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''1\" 9''3\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''0\" 1''11\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''6\" 9''9\"';\r\nvexp='7''0\" to 7''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 3''9\"';\r\nvexp='5''1\" to 5''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''5\" 2''7\"';\r\nvexp='4''11\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 1''0\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''3\" 3''9\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''0\" 6''1\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''1\" 3''11\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 2''7\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''2\" 3''3\"';\r\nvexp='2''8\" to 3''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''5\" 6''8\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''8\" 3''8\"';\r\nvexp='3''1\" to 3''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''6\" 2''9\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-06T00:21:27.000Z","updated_at":"2013-10-06T02:46:32.000Z","published_at":"2013-10-06T00:35:38.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2334486/dashboard#s=p1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Baby Height\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Only the first 82 of 5958 test cases are evaluated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex. Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\\\" while a girl is -5\\\". The range is +/- 4\\\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e str , String of Sex, Mom and Dad Height x'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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e H , string of Predicted Height Range\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [str] [H]\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[B 5'11\\\" 6'2\\\"  spawns 5'11\\\" to 6'7\\\"\\nG 5'11\\\" 6'2\\\" spawns 5'6\\\" to 6'2\\\"\\nB 3'4\\\" 3'4\\\" spawns 3'3\\\" to 3'10\\\"]]\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\u003eCommentary:\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[1) Provide input like fgetl per test case\\n2) 15 of 32 entrants completed this Challenge\\n3) This is a test of regexp and sprintf formatting (or just regexprep)]]\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":733,"title":"Extract Built In Functions and Toolbox Functions from String or Function Handle","description":"Find the Built-In functions and Toolbox functions in either a string or a function handle.\r\n\r\nGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\r\n\r\n*Inputs:*\r\n\r\nfh=@(x)log10(x)+log2(x)+abs(x)\r\n\r\nstr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\r\n\r\n*Outputs:*\r\n\r\n'abs log2 log10'\r\n\r\n'abs filter numel sin filter2 smooth3'\r\n\r\nRelated to \r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer Cody_464\u003e","description_html":"\u003cp\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\u003c/p\u003e\u003cp\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003efh=@(x)log10(x)+log2(x)+abs(x)\u003c/p\u003e\u003cp\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'abs log2 log10'\u003c/p\u003e\u003cp\u003e'abs filter numel sin filter2 smooth3'\u003c/p\u003e\u003cp\u003eRelated to  \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\"\u003eCody_464\u003c/a\u003e\u003c/p\u003e","function_template":"function functions = find_functions(fh_str)\r\n  functions = '';\r\nend","test_suite":"%%\r\nfh_str='log2(x)+smooth3(x,y)+abs(2)+log10(5)';\r\nexp_str='abs log10 log2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='for k=log10(x):log2(x)+abs(x)';\r\nexp_str='abs for log10 log2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str=@(x)x^2+sin(x)-cos(x);\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='@(x)x^2+sin(x)-cos(x)';\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='filter2(x,A)+filter(x)-cos(x) expm(z)';\r\nexp_str='cos filter expm filter2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)';\r\nexp_str='abs filter numel sin filter2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":6,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":83,"test_suite_updated_at":"2012-07-18T13:18:16.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-01T23:09:01.000Z","updated_at":"2026-03-31T20:12:36.000Z","published_at":"2012-06-02T00:17:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\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\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\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\u003eInputs:\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\u003efh=@(x)log10(x)+log2(x)+abs(x)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\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\u003eOutputs:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'abs log2 log10'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'abs filter numel sin filter2 smooth3'\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\u003eRelated to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody_464\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":1557,"title":"factor to number","description":"e.g. input number x=10 then it should produce y=25 or x=100 then y should be 2255. write a function or code to generate the same.","description_html":"\u003cp\u003ee.g. input number x=10 then it should produce y=25 or x=100 then y should be 2255. write a function or code to generate the same.\u003c/p\u003e","function_template":"function y = factor_to_number(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 10;\r\ny_correct =25;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 100;\r\ny_correct =2255;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 1000;\r\ny_correct =222555;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 10000;\r\ny_correct =22225555;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 20000;\r\ny_correct =222225555;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n\r\n%%\r\nx = 20001;\r\ny_correct =359113;\r\nassert(isequal(factor_to_number(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":13514,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":67,"test_suite_updated_at":"2013-06-06T07:30:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-06-06T07:28:19.000Z","updated_at":"2025-12-16T03:44:04.000Z","published_at":"2013-06-06T07:30:44.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\u003ee.g. input number x=10 then it should produce y=25 or x=100 then y should be 2255. write a function or code to generate the same.\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":1532,"title":"SLP Calculation","description":"The SLP Calculation Challenge is to implement SLP sequences and output the result as a string. SLP, Straight Line Program, creates a value based upon two pointers of prior values and one of the operators [ + - * ]. The first value in the sequence is 1 and is assigned pointer 0 (zero based indexing).\r\n\r\n*Input:* SLP_sequence (string)\r\n\r\n*Output:* SLP_value (string)\r\n\r\n*Example:*\r\n\r\n*Input:*\r\nSLP_sequence='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\r\n\r\nProduces:( Index 0 is 1 )\r\n\r\n2, 4, 16, 18, 288, 272, 273, 576, 78624, 79200, 6227020800\r\n\r\n*Output:*\r\n'6227020800' \r\n\r\nThe complexity to this Challenge is some solutions will exceed 2^64 and have eps\u003e1.\r\n\r\nPrior to viewing the link: What number is 2568 digits long and has 249 trailing zeros?\r\n\r\n\u003chttp://www.azspcs.net/ Al's Contests\u003e\r\n\r\n\r\n\r\n\r\n ","description_html":"\u003cp\u003eThe SLP Calculation Challenge is to implement SLP sequences and output the result as a string. SLP, Straight Line Program, creates a value based upon two pointers of prior values and one of the operators [ + - * ]. The first value in the sequence is 1 and is assigned pointer 0 (zero based indexing).\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e SLP_sequence (string)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e SLP_value (string)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e\r\nSLP_sequence='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\u003c/p\u003e\u003cp\u003eProduces:( Index 0 is 1 )\u003c/p\u003e\u003cp\u003e2, 4, 16, 18, 288, 272, 273, 576, 78624, 79200, 6227020800\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e\r\n'6227020800'\u003c/p\u003e\u003cp\u003eThe complexity to this Challenge is some solutions will exceed 2^64 and have eps\u003e1.\u003c/p\u003e\u003cp\u003ePrior to viewing the link: What number is 2568 digits long and has 249 trailing zeros?\u003c/p\u003e\u003cp\u003e\u003ca href = \"http://www.azspcs.net/\"\u003eAl's Contests\u003c/a\u003e\u003c/p\u003e","function_template":"function SLP = SLP_calc(SLP_str)\r\n  SLP = '0';\r\nend","test_suite":"SLP_str='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\r\n\r\nSLP = SLP_calc(SLP_str);\r\nSLP_exp='6227020800';\r\n\r\nassert(strcmp(SLP,SLP_exp),sprintf('%s\\n',SLP));\r\n%%\r\nSLP_str='0+0,1*1,1+2,3*3,3*4,5-3,6-4,2+5,8+2,5*6,8*9,7*11,8*10,13+10,8+14,2*13,12*15,14*16,17*18,18*19';\r\n\r\nSLP = SLP_calc(SLP_str);\r\nSLP_exp='13763753091226345046315979581580902400000000';\r\n\r\nassert(strcmp(SLP,SLP_exp),sprintf('%s\\n',SLP));\r\n%%\r\nSLP_str='0+0, 1+1, 2*2, 3-1, 3+4, 5+1, 5+4, 7+3, 8+6, 9+2, 4*4, 11+5, 8*4, 13+0, 14-12, 15+5, 8*5, 17-3, 10*9, 13*10, 15*15, 21-2, 22-19, 23-4, 21+16, 25+3, 16*16, 27-11, 28-2, 27-7, 30+2, 29+11, 32-19, 13*13, 34-2, 35-19, 27+29, 17*17, 38-2, 39-19, 39-10, 41-7, 38+2, 20*7, 44-27, 44+11, 44+35, 20*10, 48-47, 48+30, 50-40, 51-3, 50+27, 44*2, 54-35, 55-37, 55-13, 57-48, 55+9, 59-35, 60+11, 61-44, 62-53, 61+15, 60+13, 59+19, 66-62, 67-21, 52-68, 68+5, 54-24, 71-46, 59+24, 73+19, 74-26, 61+45, 66+61, 77-41, 78-63, 77-22, 80+28, 80+50, 82-13, 83+35, 84-60, 85-64, 81-86, 85+43, 88+39, 77+64, 35*36, 91+54, 92-44, 92+37, 93*91, 95*92, 93+48, 96*97, 39*40, 99-93, 99+54, 101-44, 102*99, 103*101, 102+48, 104*105, 22*23, 106*107, 107+54, 109-44, 108*110, 111*109, 110+48, 113-1, 112*113, 32*33, 115*116, 116+54, 118-114, 118-44, 117*120, 121*118, 120+48, 122*123, 124*94, 125*119, 126*30, 127*28, 98*46, 128*100, 57*31, 131*56, 130*60, 132*58, 129*61, 133*64, 134*62, 53*41, 136*51, 137*63, 135*52, 138*24, 139*71, 141*73, 144*72, 143*67, 146*68, 65*70, 147*80, 78*59, 145*90, 140*82, 142*83, 149*84, 86*37, 154*88, 148*89, 153*25, 151*26, 156*76, 75*42, 160*49, 162*87, 152*69, 163*79, 157*18, 81-52, 167+6, 164*15, 165*5, 30-15, 171-3, 150*172, 43+31, 66+59, 175+14, 176*174, 30-25, 166*178, 35-23, 180-17, 181*20, 82-33, 183*12, 60-30, 184*185, 71-40, 187*39, 188*7, 33-18, 44*190, 186*182, 192*168, 179*182, 193*177, 194*155, 169*168, 196*161, 195*173, 197*155, 198*158, 159*177, 202*161, 203*200, 170*173, 205*158, 206*200, 191*34, 208*208, 209*189, 210*210, 211*199, 212*212, 213*201, 214*214, 215*204, 216*216, 217*207';\r\n\r\ntic\r\nSLP = SLP_calc(SLP_str);\r\ntoc\r\nSLP_exp='402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000';\r\n\r\n\r\nassert(strcmp(SLP,SLP_exp),sprintf('%s\\n',SLP));\r\n\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-06-01T21:37:49.000Z","updated_at":"2013-06-01T22:56:28.000Z","published_at":"2013-06-01T22:56:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe SLP Calculation Challenge is to implement SLP sequences and output the result as a string. SLP, Straight Line Program, creates a value based upon two pointers of prior values and one of the operators [ + - * ]. The first value in the sequence is 1 and is assigned pointer 0 (zero based indexing).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e SLP_sequence (string)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e SLP_value (string)\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e SLP_sequence='0+0,1+1,2*2,3+1,3*4,5-3,6+0,5*1,5*7,9+8,9*10';\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\u003eProduces:( Index 0 is 1 )\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2, 4, 16, 18, 288, 272, 273, 576, 78624, 79200, 6227020800\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e '6227020800'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe complexity to this Challenge is some solutions will exceed 2^64 and have eps\u0026gt;1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrior to viewing the link: What number is 2568 digits long and has 249 trailing zeros?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.azspcs.net/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAl's Contests\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":45411,"title":"Compute the missing quantity among P, V, T for an ideal gas","description":"Consider 100 mol of helium gas at a certain pressure (P), volume (V), and temperature (T). Assuming that the ideal gas law applies, can you compute one of the 3 quantities given the other two?\r\n\r\nRecall that, with SI units, the ideal gas law is given by:\r\n\r\n  P x V = n x R x T\r\n    where:\r\n    P = pressure [Pa] or [kg/m/s^2]\r\n    V = volume [m^3]\r\n    n = number of moles [mol]\r\n    R = gas constant, 8.314 [J/mol/K] or [kg.m^2/K/mol/s^2]\r\n    T = temperature [K]\r\n\r\nWrite a function that takes a MATLAB variable, x, which is always a 3-element row vector containing the values of P, V, T in that order. However, exactly one of these values will be NaN, which you must solve using the ideal gas law equation above, given the other two values. All inputs are given in SI units, hence, you can use the given value of |R| above. Note that |n| = 100 mol. You are ensured that P, V, and/or T are floating-point numbers with 2 decimal places that satisfy the following constraints:\r\n\r\n* 1 x 10^5 \u003c= P \u003c= 3 x 10^5\r\n* 1 \u003c= V \u003c= 10\r\n* 300 \u003c= T \u003c= 500\r\n\r\nOutput the value of the missing quantity rounded to 2 decimal places, followed by a space, and then the correct units, either |Pa|, |m^3|, or |K|. For this, you can use |sprintf|. See sample test cases:\r\n\r\n  \u003e\u003e idealgas([233424.06 NaN 435.02])\r\nans =\r\n    '1.55 m^3'\r\n\u003e\u003e idealgas([109238.31 2.76 NaN])\r\nans =\r\n    '362.64 K'\r\n\u003e\u003e idealgas([NaN 1.19 411.97])\r\nans =\r\n    '287825.09 Pa'\r\n","description_html":"\u003cp\u003eConsider 100 mol of helium gas at a certain pressure (P), volume (V), and temperature (T). Assuming that the ideal gas law applies, can you compute one of the 3 quantities given the other two?\u003c/p\u003e\u003cp\u003eRecall that, with SI units, the ideal gas law is given by:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eP x V = n x R x T\r\n  where:\r\n  P = pressure [Pa] or [kg/m/s^2]\r\n  V = volume [m^3]\r\n  n = number of moles [mol]\r\n  R = gas constant, 8.314 [J/mol/K] or [kg.m^2/K/mol/s^2]\r\n  T = temperature [K]\r\n\u003c/pre\u003e\u003cp\u003eWrite a function that takes a MATLAB variable, x, which is always a 3-element row vector containing the values of P, V, T in that order. However, exactly one of these values will be NaN, which you must solve using the ideal gas law equation above, given the other two values. All inputs are given in SI units, hence, you can use the given value of \u003ctt\u003eR\u003c/tt\u003e above. Note that \u003ctt\u003en\u003c/tt\u003e = 100 mol. You are ensured that P, V, and/or T are floating-point numbers with 2 decimal places that satisfy the following constraints:\u003c/p\u003e\u003cul\u003e\u003cli\u003e1 x 10^5 \u0026lt;= P \u0026lt;= 3 x 10^5\u003c/li\u003e\u003cli\u003e1 \u0026lt;= V \u0026lt;= 10\u003c/li\u003e\u003cli\u003e300 \u0026lt;= T \u0026lt;= 500\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eOutput the value of the missing quantity rounded to 2 decimal places, followed by a space, and then the correct units, either \u003ctt\u003ePa\u003c/tt\u003e, \u003ctt\u003em^3\u003c/tt\u003e, or \u003ctt\u003eK\u003c/tt\u003e. For this, you can use \u003ctt\u003esprintf\u003c/tt\u003e. See sample test cases:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e\u0026gt;\u0026gt; idealgas([233424.06 NaN 435.02])\r\nans =\r\n  '1.55 m^3'\r\n\u0026gt;\u0026gt; idealgas([109238.31 2.76 NaN])\r\nans =\r\n  '362.64 K'\r\n\u0026gt;\u0026gt; idealgas([NaN 1.19 411.97])\r\nans =\r\n  '287825.09 Pa'\r\n\u003c/pre\u003e","function_template":"function y = idealgas(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(idealgas([233424.06 NaN 435.02]),'1.55 m^3'))\r\n%%\r\nassert(isequal(idealgas([294119.71 NaN 317.25]),'0.90 m^3'))\r\n%%\r\nassert(isequal(idealgas([173530.58 2.85 NaN]),'594.85 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.49 410.36]),'75985.15 Pa'))\r\n%%\r\nassert(isequal(idealgas([228388.12 5.36 NaN]),'1472.41 K'))\r\n%%\r\nassert(isequal(idealgas([120121.26 NaN 347.47]),'2.40 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.65 320.97]),'57388.06 Pa'))\r\n%%\r\nassert(isequal(idealgas([256885.58 3.62 NaN]),'1118.51 K'))\r\n%%\r\nassert(isequal(idealgas([186497.00 NaN 451.62]),'2.01 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.99 486.75]),'203358.77 Pa'))\r\n%%\r\nassert(isequal(idealgas([153235.77 8.18 NaN]),'1507.66 K'))\r\n%%\r\nassert(isequal(idealgas([179201.35 3.46 NaN]),'745.77 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 5.07 421.97]),'69196.42 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.95 439.29]),'45940.34 Pa'))\r\n%%\r\nassert(isequal(idealgas([126030.29 NaN 301.56]),'1.99 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.51 406.24]),'44973.09 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.14 326.86]),'126986.64 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.51 339.25]),'112371.49 Pa'))\r\n%%\r\nassert(isequal(idealgas([163285.80 2.96 NaN]),'581.34 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 6.00 336.89]),'46681.72 Pa'))\r\n%%\r\nassert(isequal(idealgas([115469.36 NaN 441.34]),'3.18 m^3'))\r\n%%\r\nassert(isequal(idealgas([162685.80 2.50 NaN]),'489.19 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 3.32 379.36]),'94999.97 Pa'))\r\n%%\r\nassert(isequal(idealgas([236819.21 NaN 496.57]),'1.74 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.39 376.27]),'130891.58 Pa'))\r\n%%\r\nassert(isequal(idealgas([251622.49 8.84 NaN]),'2675.42 K'))\r\n%%\r\nassert(isequal(idealgas([158829.73 NaN 466.48]),'2.44 m^3'))\r\n%%\r\nassert(isequal(idealgas([167062.27 NaN 390.52]),'1.94 m^3'))\r\n%%\r\nassert(isequal(idealgas([171921.26 NaN 448.51]),'2.17 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.12 304.89]),'119568.65 Pa'))\r\n%%\r\nassert(isequal(idealgas([163504.12 6.88 NaN]),'1353.03 K'))\r\n%%\r\nassert(isequal(idealgas([191577.27 3.16 NaN]),'728.15 K'))\r\n%%\r\nassert(isequal(idealgas([248129.61 7.69 NaN]),'2295.06 K'))\r\n%%\r\nassert(isequal(idealgas([192652.12 2.91 NaN]),'674.31 K'))\r\n%%\r\nassert(isequal(idealgas([135001.95 2.47 NaN]),'401.08 K'))\r\n%%\r\nassert(isequal(idealgas([203311.64 7.32 NaN]),'1790.04 K'))\r\n%%\r\nassert(isequal(idealgas([208176.82 7.12 NaN]),'1782.80 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.08 405.01]),'161887.17 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.59 383.02]),'69377.52 Pa'))\r\n%%\r\nassert(isequal(idealgas([151077.35 NaN 484.74]),'2.67 m^3'))\r\n%%\r\nassert(isequal(idealgas([286522.71 2.47 NaN]),'851.23 K'))\r\n%%\r\nassert(isequal(idealgas([215478.84 4.96 NaN]),'1285.51 K'))\r\n%%\r\nassert(isequal(idealgas([145733.90 1.58 NaN]),'276.95 K'))\r\n%%\r\nassert(isequal(idealgas([243042.50 NaN 383.81]),'1.31 m^3'))\r\n%%\r\nassert(isequal(idealgas([263228.02 3.86 NaN]),'1222.11 K'))\r\n%%\r\nassert(isequal(idealgas([270452.78 5.55 NaN]),'1805.40 K'))\r\n%%\r\nassert(isequal(idealgas([188792.83 NaN 473.35]),'2.08 m^3'))\r\n%%\r\nassert(isequal(idealgas([171014.73 NaN 344.83]),'1.68 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.49 328.44]),'60816.26 Pa'))\r\n%%\r\nassert(isequal(idealgas([184222.45 NaN 445.16]),'2.01 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.61 414.21]),'45252.85 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 3.39 484.92]),'118926.99 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.79 428.02]),'198802.14 Pa'))\r\n%%\r\nassert(isequal(idealgas([109010.22 NaN 369.49]),'2.82 m^3'))\r\n%%\r\nassert(isequal(idealgas([176773.72 6.65 NaN]),'1413.93 K'))\r\n%%\r\nassert(isequal(idealgas([260111.73 NaN 462.62]),'1.48 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 6.18 406.01]),'54620.83 Pa'))\r\n%%\r\nassert(isequal(idealgas([149725.79 5.06 NaN]),'911.25 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.27 407.13]),'266525.89 Pa'))\r\n%%\r\nassert(isequal(idealgas([260418.29 9.90 NaN]),'3100.96 K'))\r\n%%\r\nassert(isequal(idealgas([103635.51 NaN 456.75]),'3.66 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 9.09 425.19]),'38889.22 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.64 308.36]),'97110.04 Pa'))\r\n%%\r\nassert(isequal(idealgas([223288.70 NaN 370.89]),'1.38 m^3'))\r\n%%\r\nassert(isequal(idealgas([296869.88 9.51 NaN]),'3395.76 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.03 432.48]),'89221.80 Pa'))\r\n%%\r\nassert(isequal(idealgas([159101.45 NaN 405.57]),'2.12 m^3'))\r\n%%\r\nassert(isequal(idealgas([220527.64 NaN 416.71]),'1.57 m^3'))\r\n%%\r\nassert(isequal(idealgas([216714.12 5.61 NaN]),'1462.31 K'))\r\n%%\r\nassert(isequal(idealgas([299231.22 NaN 494.25]),'1.37 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 5.09 382.69]),'62508.54 Pa'))\r\n%%\r\nassert(isequal(idealgas([125130.92 3.78 NaN]),'568.91 K'))\r\n%%\r\nassert(isequal(idealgas([238757.52 1.09 NaN]),'313.02 K'))\r\n%%\r\nassert(isequal(idealgas([254190.84 1.38 NaN]),'421.92 K'))\r\n%%\r\nassert(isequal(idealgas([245902.61 3.02 NaN]),'893.22 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 6.61 347.29]),'43681.83 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.90 486.90]),'51241.60 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.89 397.95]),'175055.89 Pa'))\r\n%%\r\nassert(isequal(idealgas([279178.31 NaN 308.83]),'0.92 m^3'))\r\n%%\r\nassert(isequal(idealgas([254499.01 NaN 335.80]),'1.10 m^3'))\r\n%%\r\nassert(isequal(idealgas([142029.13 NaN 481.27]),'2.82 m^3'))\r\n%%\r\nassert(isequal(idealgas([120306.78 NaN 310.92]),'2.15 m^3'))\r\n%%\r\nassert(isequal(idealgas([186344.23 NaN 462.32]),'2.06 m^3'))\r\n%%\r\nassert(isequal(idealgas([278889.55 2.24 NaN]),'751.40 K'))\r\n%%\r\nassert(isequal(idealgas([283498.77 NaN 423.67]),'1.24 m^3'))\r\n%%\r\nassert(isequal(idealgas([287205.47 NaN 446.12]),'1.29 m^3'))\r\n%%\r\nassert(isequal(idealgas([266630.40 4.58 NaN]),'1468.81 K'))\r\n%%\r\nassert(isequal(idealgas([164492.08 NaN 495.83]),'2.51 m^3'))\r\n%%\r\nassert(isequal(idealgas([166084.72 6.58 NaN]),'1314.45 K'))\r\n%%\r\nassert(isequal(idealgas([182780.15 5.43 NaN]),'1193.76 K'))\r\n%%\r\nassert(isequal(idealgas([165550.99 8.54 NaN]),'1700.51 K'))\r\n%%\r\nassert(isequal(idealgas([NaN 4.21 432.53]),'85416.97 Pa'))\r\n%%\r\nassert(isequal(idealgas([146076.61 NaN 424.91]),'2.42 m^3'))\r\n%%\r\nassert(isequal(idealgas([232087.59 NaN 369.76]),'1.32 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 7.44 471.24]),'52659.80 Pa'))\r\n%%\r\nassert(isequal(idealgas([NaN 2.24 467.34]),'173458.25 Pa'))\r\n%%\r\nassert(isequal(idealgas([217641.88 NaN 461.35]),'1.76 m^3'))\r\n%%\r\nassert(isequal(idealgas([197918.87 NaN 370.63]),'1.56 m^3'))\r\n%%\r\nassert(isequal(idealgas([NaN 1.38 494.59]),'297972.56 Pa'))\r\n","published":true,"deleted":false,"likes_count":9,"comments_count":0,"created_by":255320,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":189,"test_suite_updated_at":"2020-03-31T14:35:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-03-31T13:58:54.000Z","updated_at":"2026-03-19T20:10:53.000Z","published_at":"2020-03-31T14:35:13.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConsider 100 mol of helium gas at a certain pressure (P), volume (V), and temperature (T). Assuming that the ideal gas law applies, can you compute one of the 3 quantities given the other two?\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\u003eRecall that, with SI units, the ideal gas law is given by:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[P x V = n x R x T\\n  where:\\n  P = pressure [Pa] or [kg/m/s^2]\\n  V = volume [m^3]\\n  n = number of moles [mol]\\n  R = gas constant, 8.314 [J/mol/K] or [kg.m^2/K/mol/s^2]\\n  T = temperature [K]]]\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\u003eWrite a function that takes a MATLAB variable, x, which is always a 3-element row vector containing the values of P, V, T in that order. However, exactly one of these values will be NaN, which you must solve using the ideal gas law equation above, given the other two values. All inputs are given in SI units, hence, you can use the given value of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eR\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e above. Note that\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e = 100 mol. You are ensured that P, V, and/or T are floating-point numbers with 2 decimal places that satisfy the following constraints:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 x 10^5 \u0026lt;= P \u0026lt;= 3 x 10^5\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1 \u0026lt;= V \u0026lt;= 10\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e300 \u0026lt;= T \u0026lt;= 500\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 the value of the missing quantity rounded to 2 decimal places, followed by a space, and then the correct units, either\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\u003ePa\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003em^3\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, or\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\u003eK\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. For this, you can use\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\u003esprintf\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. See sample test cases:\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[\u003e\u003e idealgas([233424.06 NaN 435.02])\\nans =\\n  '1.55 m^3'\\n\u003e\u003e idealgas([109238.31 2.76 NaN])\\nans =\\n  '362.64 K'\\n\u003e\u003e idealgas([NaN 1.19 411.97])\\nans =\\n  '287825.09 Pa']]\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":1915,"title":"GJam 2013 Veterans: Baby Height Prediction","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p1 GJam 2013 Veterans Baby Height\u003e. Only the first 82 of 5958 test cases are evaluated.\r\n\r\nThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\r\n\r\n\r\n*Input:* str , String of Sex, Mom and Dad Height x'y\"\r\n\r\n*Output:* H , string of Predicted Height Range\r\n\r\n*Examples:* [str] [H]\r\n\r\n  B 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\n  G 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\n  B 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n  \r\n\r\n*Commentary:*\r\n\r\n  1) Provide input like fgetl per test case\r\n  2) 15 of 32 entrants completed this Challenge\r\n  3) This is a test of regexp and sprintf formatting (or just regexprep)","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p1\"\u003eGJam 2013 Veterans Baby Height\u003c/a\u003e. Only the first 82 of 5958 test cases are evaluated.\u003c/p\u003e\u003cp\u003eThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e str , String of Sex, Mom and Dad Height x'y\"\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e H , string of Predicted Height Range\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [str] [H]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eB 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\nG 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\nB 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Provide input like fgetl per test case\r\n2) 15 of 32 entrants completed this Challenge\r\n3) This is a test of regexp and sprintf formatting (or just regexprep)\r\n\u003c/pre\u003e","function_template":"function [H]=BabyH_V(str)\r\n H='';\r\n v= regexp(str,'[''''\"\\s]','split');\r\nend","test_suite":"%%\r\ntic\r\nvstr='G 7''4\" 9''11\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''1\" 4''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''3\" 2''9\"';\r\nvexp='3''5\" to 4''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''10\" 4''4\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''0\" 9''7\"';\r\nvexp='7''3\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''5\" 4''8\"';\r\nvexp='3''6\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''3\" 7''9\"';\r\nvexp='7''6\" to 8''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''7\" 8''0\"';\r\nvexp='8''2\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''10\" 1''3\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''9\" 1''5\"';\r\nvexp='1''7\" to 2''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 8''9\"';\r\nvexp='7''4\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''7\" 9''3\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''2\" 7''11\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''0\" 3''9\"';\r\nvexp='2''10\" to 3''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 3''3\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''6\" 1''4\"';\r\nvexp='1''5\" to 2''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''8\" 8''7\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''11\" 7''3\"';\r\nvexp='8''1\" to 8''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''0\" 1''2\"';\r\nvexp='4''7\" to 5''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''0\" 1''2\"';\r\nvexp='3''7\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 5''7\"';\r\nvexp='5''5\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 6''1\"';\r\nvexp='4''10\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''7\" 2''3\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 6''7\"';\r\nvexp='6''7\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 6''5\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''3\" 4''11\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''0\" 5''6\"';\r\nvexp='3''3\" to 3''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''7\" 6''8\"';\r\nvexp='3''7\" to 4''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 5''11\"';\r\nvexp='4''0\" to 4''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 3''6\"';\r\nvexp='2''9\" to 3''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''10\" 1''9\"';\r\nvexp='5''8\" to 6''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 5''11\"';\r\nvexp='4''8\" to 5''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 1''2\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 3''7\" 9''1\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 9''11\"';\r\nvexp='7''10\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''10\" 8''10\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 7''4\"';\r\nvexp='6''7\" to 7''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''9\" 4''8\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''8\" 6''3\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 8''4\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''7\" 9''6\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''7\" 7''1\"';\r\nvexp='4''4\" to 4''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''1\" 7''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''5\" 8''7\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''0\" 1''0\"';\r\nvexp='2''0\" to 2''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''4\" 7''1\"';\r\nvexp='5''7\" to 6''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''1\" 8''1\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 7''8\"';\r\nvexp='6''0\" to 6''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 8''2\"';\r\nvexp='7''4\" to 8''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''6\" 5''1\"';\r\nvexp='3''9\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 6''9\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 5''8\"';\r\nvexp='5''6\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''4\" 2''10\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''7\" 9''5\"';\r\nvexp='7''11\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''6\" 5''7\"';\r\nvexp='6''5\" to 7''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 8''10\"';\r\nvexp='7''9\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 3''2\"';\r\nvexp='4''3\" to 4''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''3\" 8''3\"';\r\nvexp='8''3\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''7\" 1''4\"';\r\nvexp='2''11\" to 3''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''2\" 2''4\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''2\" 5''8\"';\r\nvexp='6''11\" to 7''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''4\" 5''5\"';\r\nvexp='5''9\" to 6''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 7''7\"';\r\nvexp='8''5\" to 9''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 1''2\"';\r\nvexp='2''4\" to 2''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''10\" 3''7\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''10\" 2''8\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''5\" 4''3\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''1\" 3''0\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''1\" 9''3\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''0\" 1''11\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''6\" 9''9\"';\r\nvexp='7''0\" to 7''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 3''9\"';\r\nvexp='5''1\" to 5''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''5\" 2''7\"';\r\nvexp='4''11\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 1''0\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''3\" 3''9\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''0\" 6''1\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''1\" 3''11\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 2''7\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''2\" 3''3\"';\r\nvexp='2''8\" to 3''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''5\" 6''8\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''8\" 3''8\"';\r\nvexp='3''1\" to 3''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''6\" 2''9\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-06T00:21:27.000Z","updated_at":"2013-10-06T02:46:32.000Z","published_at":"2013-10-06T00:35:38.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is derived from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://code.google.com/codejam/contest/2334486/dashboard#s=p1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Baby Height\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Only the first 82 of 5958 test cases are evaluated.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex. Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\\\" while a girl is -5\\\". The range is +/- 4\\\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e str , String of Sex, Mom and Dad Height x'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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e H , string of Predicted Height Range\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [str] [H]\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[B 5'11\\\" 6'2\\\"  spawns 5'11\\\" to 6'7\\\"\\nG 5'11\\\" 6'2\\\" spawns 5'6\\\" to 6'2\\\"\\nB 3'4\\\" 3'4\\\" spawns 3'3\\\" to 3'10\\\"]]\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\u003eCommentary:\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[1) Provide input like fgetl per test case\\n2) 15 of 32 entrants completed this Challenge\\n3) This is a test of regexp and sprintf formatting (or just regexprep)]]\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":733,"title":"Extract Built In Functions and Toolbox Functions from String or Function Handle","description":"Find the Built-In functions and Toolbox functions in either a string or a function handle.\r\n\r\nGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\r\n\r\n*Inputs:*\r\n\r\nfh=@(x)log10(x)+log2(x)+abs(x)\r\n\r\nstr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\r\n\r\n*Outputs:*\r\n\r\n'abs log2 log10'\r\n\r\n'abs filter numel sin filter2 smooth3'\r\n\r\nRelated to \r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer Cody_464\u003e","description_html":"\u003cp\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\u003c/p\u003e\u003cp\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003efh=@(x)log10(x)+log2(x)+abs(x)\u003c/p\u003e\u003cp\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'abs log2 log10'\u003c/p\u003e\u003cp\u003e'abs filter numel sin filter2 smooth3'\u003c/p\u003e\u003cp\u003eRelated to  \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\"\u003eCody_464\u003c/a\u003e\u003c/p\u003e","function_template":"function functions = find_functions(fh_str)\r\n  functions = '';\r\nend","test_suite":"%%\r\nfh_str='log2(x)+smooth3(x,y)+abs(2)+log10(5)';\r\nexp_str='abs log10 log2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='for k=log10(x):log2(x)+abs(x)';\r\nexp_str='abs for log10 log2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str=@(x)x^2+sin(x)-cos(x);\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='@(x)x^2+sin(x)-cos(x)';\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='filter2(x,A)+filter(x)-cos(x) expm(z)';\r\nexp_str='cos filter expm filter2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)';\r\nexp_str='abs filter numel sin filter2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":6,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":83,"test_suite_updated_at":"2012-07-18T13:18:16.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-01T23:09:01.000Z","updated_at":"2026-03-31T20:12:36.000Z","published_at":"2012-06-02T00:17:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\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\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\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\u003eInputs:\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\u003efh=@(x)log10(x)+log2(x)+abs(x)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\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\u003eOutputs:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'abs log2 log10'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'abs filter numel sin filter2 smooth3'\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\u003eRelated to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody_464\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"sprintf\"","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:\"sprintf\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"sprintf\"","","\"","sprintf","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a676c0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fdbc1a67580\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a66cc0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a67940\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdbc1a678a0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdbc1a67800\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdbc1a67760\u003e":"tag:\"sprintf\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a67760\u003e":"tag:\"sprintf\""},"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:\"sprintf\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"sprintf\"","","\"","sprintf","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a676c0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fdbc1a67580\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a66cc0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a67940\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fdbc1a678a0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fdbc1a67800\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fdbc1a67760\u003e":"tag:\"sprintf\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fdbc1a67760\u003e":"tag:\"sprintf\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":1557,"difficulty_rating":"easy-medium"},{"id":1532,"difficulty_rating":"easy-medium"},{"id":45411,"difficulty_rating":"easy-medium"},{"id":1915,"difficulty_rating":"easy-medium"},{"id":733,"difficulty_rating":"medium-hard"}]}}