{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":2362,"title":"What day is it?","description":"Tell me what day is it. Return the full name of the day of the week as a string.\r\n\r\ne.g. It's June 12th 2014, so your function should return 'Thursday'","description_html":"\u003cp\u003eTell me what day is it. Return the full name of the day of the week as a string.\u003c/p\u003e\u003cp\u003ee.g. It's June 12th 2014, so your function should return 'Thursday'\u003c/p\u003e","function_template":"function y = day_of_week()\r\ny = 'Friday';\r\nend","test_suite":"%%\r\ntoday = java.util.Date;\r\nc = java.util.Calendar.getInstance();\r\nc.setTime( today );\r\ndayOfWeek = c.get(java.util.Calendar.DAY_OF_WEEK);\r\nswitch dayOfWeek\r\n    case 1\r\n        dayOfWeek = 'Sunday';    \r\n    case 2\r\n        dayOfWeek = 'Monday';\r\n    case 3\r\n        dayOfWeek = 'Tuesday';\r\n    case 4\r\n        dayOfWeek = 'Wednesday';\r\n    case 5\r\n        dayOfWeek = 'Thursday';\r\n    case 6\r\n        dayOfWeek = 'Friday';\r\n    case 7\r\n        dayOfWeek = 'Saturday';\r\nend\r\nassert(strcmp(dayOfWeek,day_of_week()))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":450,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":222,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-06-12T20:06:06.000Z","updated_at":"2026-03-12T20:06:11.000Z","published_at":"2014-06-13T14:20:59.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\u003eTell me what day is it. Return the full name of the day of the week as a 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ee.g. It's June 12th 2014, so your function should return 'Thursday'\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":42711,"title":"Find Month \u0026 day for given day number of a year ","description":"Find Month \u0026 day for given day number of a year  (day number is any number ranging from 1 to 366)","description_html":"\u003cp\u003eFind Month \u0026 day for given day number of a year  (day number is any number ranging from 1 to 366)\u003c/p\u003e","function_template":"function vec = your_fcn_name(x)\r\n%%logic\r\nend","test_suite":"%%\r\nx = 23;\r\nvec_crt=[1 23];\r\nassert(isequal(your_fcn_name(x),vec_crt))\r\n%%\r\nx = 54;\r\nvec_crt=[2 23];\r\nassert(isequal(your_fcn_name(x),vec_crt))\r\n%%\r\nx = 231;\r\nvec_crt=[8 18];\r\nassert(isequal(your_fcn_name(x),vec_crt))\r\n%%\r\nx = 300;\r\nvec_crt=[10 26];\r\nassert(isequal(your_fcn_name(x),vec_crt))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":46868,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":96,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-01-15T06:34:44.000Z","updated_at":"2026-01-05T00:10:53.000Z","published_at":"2016-01-15T06:48:57.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\u003eFind Month \u0026amp; day for given day number of a year (day number is any number ranging from 1 to 366)\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":43612,"title":"time of day","description":"Calculate the time of day in days, hours, minutes or seconds passed since the beginning of the day, depending on the unit. The unit is given as a string: \r\n\r\n  validUnits = {'nanoseconds'; 'microseconds'; 'milliseconds'; ...\r\n  'seconds'; 'minutes'; 'hours'; 'days'};","description_html":"\u003cp\u003eCalculate the time of day in days, hours, minutes or seconds passed since the beginning of the day, depending on the unit. The unit is given as a string:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003evalidUnits = {'nanoseconds'; 'microseconds'; 'milliseconds'; ...\r\n'seconds'; 'minutes'; 'hours'; 'days'};\r\n\u003c/pre\u003e","function_template":"function y = timeOfDay(x, unit)\r\n  y = 1;\r\nend","test_suite":"%%\r\nx = '12-Jan-2000 00:06:16';\r\ny_correct = 376 * 1e9;\r\nunits = 'nanoseconds';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '12-Jan-2000 00:06:16';\r\ny_correct = 0.10444444;\r\nunits = 'hours';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '11-Nov-1911 11:11:11';\r\ny_correct = 40271;\r\nunits = 'seconds';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '11-Nov-1911 11:11:11';\r\ny_correct = 0.4660995;\r\nunits = 'days';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '24-Oct-2016 20:26:28';\r\ny_correct = [73588*1e9 73588*1e6 73588000 ...\r\n    73588 1226.4667 20.441111 0.85171296];\r\nunits = {'nanoseconds', 'microseconds', 'milliseconds',...\r\n    'seconds', 'minutes', 'hours', 'days'};\r\nfor i = 1:numel(y_correct)\r\n    assert(abs(timeOfDay(x, units{i}) - y_correct(i)) / y_correct(i) \u003c 1e-3)\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":"2016-12-06T18:54:26.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T19:04:23.000Z","updated_at":"2025-12-31T13:52:42.000Z","published_at":"2016-10-24T19:04:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCalculate the time of day in days, hours, minutes or seconds passed since the beginning of the day, depending on the unit. The unit is given as a string:\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[validUnits = {'nanoseconds'; 'microseconds'; 'milliseconds'; ...\\n'seconds'; 'minutes'; 'hours'; 'days'};]]\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":720,"title":"Find number of days","description":"The input is two date in string format (dd-mm-yyyy)\r\n\r\nfind out the number of days between these two dates.\r\nExample:\r\n\r\ninput: '15-jan-2000' '24-may-2012'\r\n\r\n(if today is 24-may-2012)\r\n\r\noutput: 4509","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 171px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 85.5px; transform-origin: 407px 85.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 336.5px 8px; transform-origin: 336.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe input is two date in string format (dd-mm-yyyy), Find out the number of days between these two dates. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.5px 8px; transform-origin: 30.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample: \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 108px 8px; transform-origin: 108px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003einput: '15-jan-2000' '24-may-2012'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 79px 8px; transform-origin: 79px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e(if today is 24-may-2012)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40px 8px; transform-origin: 40px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eoutput: 4509\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = countDays(x1,x2)\r\n","test_suite":"%%\r\nx1 = '15-jan-2000';\r\nx2 = '24-may-2012';\r\ny_correct = 4513;\r\nassert(isequal(countDays(x1,x2),y_correct))\r\n\r\n%%\r\nx1 = '15-jan-1000';\r\nx2 = '24-may-2012';\r\ny_correct =  369755;\r\nassert(isequal(countDays(x1,x2),y_correct))\r\n\r\n%%\r\nx1 = '24-may-2013';\r\nx2 = '24-may-2012';\r\ny_correct =  365;\r\nassert(isequal(countDays(x1,x2),y_correct))\r\n\r\n%%\r\nx1 = '30-apr-2021';\r\nx2 = '30-apr-2021';\r\nassert(isequal(countDays(x1,x2),0))","published":true,"deleted":false,"likes_count":0,"comments_count":7,"created_by":4320,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":238,"test_suite_updated_at":"2021-04-19T08:49:24.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2012-05-24T12:45:19.000Z","updated_at":"2026-01-05T00:22:17.000Z","published_at":"2012-05-24T12:49:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe input is two date in string format (dd-mm-yyyy), Find out the number of days between these two dates. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample: \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003einput: '15-jan-2000' '24-may-2012'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(if today is 24-may-2012)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput: 4509\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43275,"title":"calculate the day of the year from a date string.","description":"'09-Oct-2016' is the 283rd day of the year.\r\nSo\r\n\r\n  doy = dayoftheyear('09-Oct-2016')\r\n\r\nshould return\r\n\r\n  doy = 283","description_html":"\u003cp\u003e'09-Oct-2016' is the 283rd day of the year.\r\nSo\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edoy = dayoftheyear('09-Oct-2016')\r\n\u003c/pre\u003e\u003cp\u003eshould return\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edoy = 283\r\n\u003c/pre\u003e","function_template":"function doy = dayoftheyear(date)\r\n  doy = 283;\r\nend","test_suite":"%%\r\nstart = '09-Oct-2016';\r\nfor i = 1:10\r\n    date = datestr(datenum(start) + i);\r\n    doy_correct = 283 + i;\r\n    doy = dayoftheyear(date);\r\n    assert(isequal(doy, doy_correct));\r\nend\r\nstart = '04-Oct-1937';\r\nfor i = 1:10\r\n    date = datestr(datenum(start) + i);\r\n    doy_correct = 277 + i;\r\n    doy = dayoftheyear(date);\r\n    assert(isequal(doy, doy_correct));\r\nend","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":128,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-09T11:24:48.000Z","updated_at":"2026-01-04T23:58:05.000Z","published_at":"2016-10-09T11:24:48.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\u003e'09-Oct-2016' is the 283rd day of the year. So\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[doy = dayoftheyear('09-Oct-2016')]]\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\u003eshould return\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[doy = 283]]\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":43611,"title":"microseconds passed today","description":"Calculate the amount of microseconds passed for a given date string. Return the value, rounded to the nearest integer, as a string.","description_html":"\u003cp\u003eCalculate the amount of microseconds passed for a given date string. Return the value, rounded to the nearest integer, as a string.\u003c/p\u003e","function_template":"function y = microsecondsPassedToday(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = '24-Oct-2016 20:26:28';\r\ny_correct = '73588000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '24-Oct-2016 20:29:48';\r\ny_correct = '73788000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '14-Feb-2002 08:19:04';\r\ny_correct = '29944000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '07-Apr-1902 10:00:00';\r\ny_correct = '36000000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '11-Nov-1911 11:11:11';\r\ny_correct = '40271000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":85,"test_suite_updated_at":"2016-12-05T19:16:06.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T18:40:02.000Z","updated_at":"2026-01-04T23:59:11.000Z","published_at":"2016-10-24T18:40:02.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eCalculate the amount of microseconds passed for a given date string. Return the value, rounded to the nearest integer, as a string.\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":2196,"title":"Tax Season ! How much is my salary?","description":"Tax Season! I was employed for a period from x until y in a year and I get pay check of amount z on every alternate Friday of the week starting from first Friday since I am employed. Help me find out how much did I earn during my employment period.\r\n\r\nExample\r\n\r\n x = 01-Jan-2014\r\n y = 14-Feb-2014\r\n z = $2000 (x will always be \u003cy)\r\n\r\nThis period has total 4 alternate Fridays which were my \"pay-days\", so the salary for this period was 4*2000 = %8000\r\n\r\n","description_html":"\u003cp\u003eTax Season! I was employed for a period from x until y in a year and I get pay check of amount z on every alternate Friday of the week starting from first Friday since I am employed. Help me find out how much did I earn during my employment period.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e x = 01-Jan-2014\r\n y = 14-Feb-2014\r\n z = $2000 (x will always be \u0026lt;y)\u003c/pre\u003e\u003cp\u003eThis period has total 4 alternate Fridays which were my \"pay-days\", so the salary for this period was 4*2000 = %8000\u003c/p\u003e","function_template":"function salary= AllAboutMoney_Honey(x,y,z)\r\nsalary = 0;\r\nend","test_suite":"%%\r\nx = '01-Jan-2014';\r\ny = '14-Feb-2014';\r\nz = 2000;\r\nsalary = 8000;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n\r\n%%\r\nx = '14-Feb-2013';\r\ny = '29-Apr-2013';\r\nz = 3599;\r\nsalary = 21594;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n\r\n%%\r\nx = '01-Jan-2012';\r\ny = '31-Dec-2012';\r\nz = 500;\r\nsalary = 13000;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n\r\n%%\r\nx = '13-Dec-2011';\r\ny = '28-Jan-2012';\r\nz = 654;\r\nsalary = 2616;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":82,"test_suite_updated_at":"2014-02-18T17:46:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-18T17:13:55.000Z","updated_at":"2026-01-05T00:12:47.000Z","published_at":"2014-02-18T17:15:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTax Season! I was employed for a period from x until y in a year and I get pay check of amount z on every alternate Friday of the week starting from first Friday since I am employed. Help me find out how much did I earn during my employment period.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = 01-Jan-2014\\n y = 14-Feb-2014\\n z = $2000 (x will always be \u003cy)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis period has total 4 alternate Fridays which were my \\\"pay-days\\\", so the salary for this period was 4*2000 = %8000\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":216,"title":"Is this date a palindrome?emordnilap a etad siht sI","description":"Take a MATLAB date number as input, and return true if the date is a palindrome, false if the date is not a palindrome.  A date number is a scalar double representing the decimal days since Jan. 1, 0000 (type \"help datenum\").\r\n\r\nThe date shall be considered a palindrome if the \"mmddyy\" form of the date is a palindrome with leading zeros removed from months and days.  Thus, a date number of 706076 corresponds to March 3, 1933, which can be written 03/03/33.  Then the leading zeros are removed to get \"3333\" --\u003e true.  Date number 695118 corresponds to March 3, 1903, i.e. \"030303\" which reduces to \"3303\" --\u003e false.","description_html":"\u003cp\u003eTake a MATLAB date number as input, and return true if the date is a palindrome, false if the date is not a palindrome.  A date number is a scalar double representing the decimal days since Jan. 1, 0000 (type \"help datenum\").\u003c/p\u003e\u003cp\u003eThe date shall be considered a palindrome if the \"mmddyy\" form of the date is a palindrome with leading zeros removed from months and days.  Thus, a date number of 706076 corresponds to March 3, 1933, which can be written 03/03/33.  Then the leading zeros are removed to get \"3333\" --\u003e true.  Date number 695118 corresponds to March 3, 1903, i.e. \"030303\" which reduces to \"3303\" --\u003e false.\u003c/p\u003e","function_template":"function tf = isPalindrome(d)\r\n  tf = false;\r\nend","test_suite":"%%\r\nd = datenum('01-Jan-2011 02:02:02',0);\r\ntf = true;\r\nassert(isequal(isPalindrome(d),tf))\r\n\r\n%%\r\nd = datenum('02/01/12',2);\r\ntf = true;\r\nassert(isequal(isPalindrome(d),tf))\r\n\r\n%%\r\nd = datenum('12-Nov-1943',1);\r\ntf = false;\r\nassert(isequal(isPalindrome(d),tf))\r\n\r\n%%\r\nd = datenum('10/10/01',2);\r\ntf = false;\r\nassert(isequal(isPalindrome(d),tf))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":80,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":90,"test_suite_updated_at":"2018-08-30T16:48:29.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-01T16:08:32.000Z","updated_at":"2026-01-05T00:09:20.000Z","published_at":"2012-02-01T23:06:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake a MATLAB date number as input, and return true if the date is a palindrome, false if the date is not a palindrome. A date number is a scalar double representing the decimal days since Jan. 1, 0000 (type \\\"help datenum\\\").\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe date shall be considered a palindrome if the \\\"mmddyy\\\" form of the date is a palindrome with leading zeros removed from months and days. Thus, a date number of 706076 corresponds to March 3, 1933, which can be written 03/03/33. Then the leading zeros are removed to get \\\"3333\\\" --\u003e true. Date number 695118 corresponds to March 3, 1903, i.e. \\\"030303\\\" which reduces to \\\"3303\\\" --\u003e false.\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":1044,"title":"Create a Cell array of month-end date strings within a date range","description":"This is a variation of \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range Get an array of month-ends by T.D.\u003e where the result is now a cell array of date strings.\r\n\r\nFor example:\r\n\r\n  date_start = datenum('10 Nov 2010');\r\n  date_end   = datenum('10 Feb 2011');\r\n  dates_me   = month_ends(date_start, date_end); \r\n  dates_me\r\n  dates_me = \r\n     '30-Nov-2010' '31-Dec-2010' '31-Jan-2011'\r\n  \r\nThis is the improved proper usage of Cell-array version of \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1040-create-a-cell-array-of-month-end-date-strings-within-a-provided-date-range Challenge 1040\u003e.\r\nThanks to J.G. for identifying the proper usage.\r\n\r\n","description_html":"\u003cp\u003eThis is a variation of \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range\"\u003eGet an array of month-ends by T.D.\u003c/a\u003e where the result is now a cell array of date strings.\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edate_start = datenum('10 Nov 2010');\r\ndate_end   = datenum('10 Feb 2011');\r\ndates_me   = month_ends(date_start, date_end); \r\ndates_me\r\ndates_me = \r\n   '30-Nov-2010' '31-Dec-2010' '31-Jan-2011'\r\n\u003c/pre\u003e\u003cp\u003eThis is the improved proper usage of Cell-array version of \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/1040-create-a-cell-array-of-month-end-date-strings-within-a-provided-date-range\"\u003eChallenge 1040\u003c/a\u003e.\r\nThanks to J.G. for identifying the proper usage.\u003c/p\u003e","function_template":"function y = month_ends(date_start,date_end)\r\n y{1}=datestr(date_start,'dd-mmm-yyyy');\r\n y{2}=datestr(date_start,'dd-mmm-yyyy');\r\n  \r\nend","test_suite":"%%\r\nd1 = datenum('10-Nov-2010');\r\nd2 = datenum('10-Feb-2011');\r\ny_correct = {'30-Nov-2010','31-Dec-2010','31-Jan-2011'};\r\ndates_me=month_ends(d1,d2)\r\nassert(isequal(dates_me,y_correct))\r\n\r\n%%\r\nd1 = datenum('31-Jan-2000');\r\nd2 = datenum('10-Apr-2000');\r\ny_correct = {'31-Jan-2000','29-Feb-2000','31-Mar-2000'};\r\ndates_me=month_ends(d1,d2)\r\nassert(isequal(dates_me,y_correct))\r\n\r\n%%\r\nd1 = datenum('05-Feb-2012');\r\nd2 = datenum('10-Jul-2012');\r\ny_correct = {'29-Feb-2012','31-Mar-2012','30-Apr-2012','31-May-2012','30-Jun-2012'};\r\n\r\ndates_me=month_ends(d1,d2)\r\nassert(isequal(dates_me,y_correct))\r\n\r\n","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":78,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-11-21T02:41:42.000Z","updated_at":"2026-01-05T00:12:04.000Z","published_at":"2012-11-21T02:45:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is a variation of\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/1039-get-an-array-of-month-ends-in-a-date-range\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGet an array of month-ends by T.D.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e where the result is now a cell array of date strings.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\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[date_start = datenum('10 Nov 2010');\\ndate_end   = datenum('10 Feb 2011');\\ndates_me   = month_ends(date_start, date_end); \\ndates_me\\ndates_me = \\n   '30-Nov-2010' '31-Dec-2010' '31-Jan-2011']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the improved proper usage of Cell-array version of\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/1040-create-a-cell-array-of-month-end-date-strings-within-a-provided-date-range\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eChallenge 1040\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Thanks to J.G. for identifying the proper usage.\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":43610,"title":"nanoseconds passed today","description":"Calculate the amount of nanoseconds passed in the current day of a certain date string.","description_html":"\u003cp\u003eCalculate the amount of nanoseconds passed in the current day of a certain date string.\u003c/p\u003e","function_template":"function y = nanosecondsPassedToday(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = '24-Oct-2016 20:26:28';\r\ny_correct = 73587999999895.69;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n\r\n%%\r\nx = '24-Oct-2016 20:29:48';\r\ny_correct = 73788000001385.8;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n\r\n%%\r\nx = '31-Oct-2016 13:19:42';\r\ny_correct = 47982000002637.5;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n\r\n%%\r\nx = '04-Jan-1972 07:24:17';\r\ny_correct = 26656999999657.3;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":9,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2016-12-05T18:57:37.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T18:32:01.000Z","updated_at":"2026-03-19T08:27:13.000Z","published_at":"2016-10-24T18:32:48.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\u003eCalculate the amount of nanoseconds passed in the current day of a certain date string.\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":42353,"title":"Can't wait for NewYear ball drop !","description":"Given an input string of the form 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss', return a string message indicating how many days, hours, minutes and seconds are left to the NewYear ball drop. Examples:\r\n\r\n  Input = '2014-05-26 10:15:45';\r\n  Output = '219 days, 13 hours, 44 minutes, 15 seconds to go.'\r\n  \r\n  Input = '2014-12-31 10:15:45';;\r\n  Output = '000 days, 13 hours, 44 minutes, 15 seconds to go.'","description_html":"\u003cp\u003eGiven an input string of the form 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss', return a string message indicating how many days, hours, minutes and seconds are left to the NewYear ball drop. Examples:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eInput = '2014-05-26 10:15:45';\r\nOutput = '219 days, 13 hours, 44 minutes, 15 seconds to go.'\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eInput = '2014-12-31 10:15:45';;\r\nOutput = '000 days, 13 hours, 44 minutes, 15 seconds to go.'\r\n\u003c/pre\u003e","function_template":"function y = CantWaitTillBallDrops(x)\r\n  y = '';\r\nend","test_suite":"%%\r\nx = '2014-12-31 10:15:45';\r\ny_correct = '000 days, 13 hours, 44 minutes, 15 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n%%\r\nx = '2014-05-26 10:15:45';\r\ny_correct = '219 days, 13 hours, 44 minutes, 15 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n%%\r\nx = '2015-12-30';\r\ny_correct = '002 days, 00 hours, 00 minutes, 00 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n%%\r\nx = '2015-05-26';\r\ny_correct = '220 days, 00 hours, 00 minutes, 00 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":44306,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":"2015-06-02T19:06:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-06-02T18:55:35.000Z","updated_at":"2026-01-01T13:58:46.000Z","published_at":"2015-06-02T19:06:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an input string of the form 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss', return a string message indicating how many days, hours, minutes and seconds are left to the NewYear ball drop. Examples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Input = '2014-05-26 10:15:45';\\nOutput = '219 days, 13 hours, 44 minutes, 15 seconds to go.'\\n\\nInput = '2014-12-31 10:15:45';;\\nOutput = '000 days, 13 hours, 44 minutes, 15 seconds to go.']]\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":2524,"title":"weekday and month ","description":"Given a year and a weekday, determine how many months of that year had five of those weekdays. It is kind of easy to find.\r\nExample:\r\ny = 2014\r\nd = 'Sun'\r\n\r\nresult = 4","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 163.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 81.8667px; transform-origin: 407px 81.8667px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 237.5px 8px; transform-origin: 237.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a year and a weekday, determine how many months of that year had \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 13.5px 8px; transform-origin: 13.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003efive\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 125px 8px; transform-origin: 125px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of those weekdays. It is kind of easy to find.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.5px 8px; transform-origin: 28.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 32px 8.5px; tab-size: 4; transform-origin: 32px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ey = 2014\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 36px 8.5px; tab-size: 4; transform-origin: 36px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003ed = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e'Sun'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 40px 8.5px; tab-size: 4; transform-origin: 40px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eresult = 4\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = dd(year,day)\r\n  y = x;\r\nend","test_suite":"%%\r\nyear = 2014;\r\nday = 'Sun'\r\ny_correct = 4;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2014;\r\nday = 'Wed'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2025;\r\nday = 'Mon'\r\ny_correct = 4;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 1999;\r\nday = 'Fri'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2020;\r\nday = 'Thu'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2000;\r\nday = 'Sat'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2022;\r\nday = 'Tue'\r\ny_correct = 4;\r\nassert(isequal(dd(year,day),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":71,"test_suite_updated_at":"2022-01-28T09:58:21.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-08-20T10:55:40.000Z","updated_at":"2026-01-05T00:00:24.000Z","published_at":"2014-08-20T10:55:40.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a year and a weekday, determine how many months of that year had \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efive\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of those weekdays. It is kind of easy to find.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[y = 2014\\nd = 'Sun'\\n\\nresult = 4]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45207,"title":"Calculate days until Christmas","description":"Provided with inputs year, month, day e.g. 2019,11,12, calculate the number of days until the next Christmas day, i.e. the next time it will be December 25","description_html":"\u003cp\u003eProvided with inputs year, month, day e.g. 2019,11,12, calculate the number of days until the next Christmas day, i.e. the next time it will be December 25\u003c/p\u003e","function_template":"function num = daysUntilChristmas(y,m,d)\r\n  num = 0;\r\nend","test_suite":"%%\r\nassert(isequal(daysUntilChristmas(2019,11,19),36))\r\n%%\r\nassert(isequal(daysUntilChristmas(2018,12,28),362))\r\n%%\r\nassert(isequal(daysUntilChristmas(2019,01,01),358))\r\n%%\r\nassert(isequal(daysUntilChristmas(2019,12,30),361))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":348097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":350,"test_suite_updated_at":"2019-11-19T16:17:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-19T16:06:18.000Z","updated_at":"2026-04-01T08:10:22.000Z","published_at":"2019-11-19T16:17:03.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\u003eProvided with inputs year, month, day e.g. 2019,11,12, calculate the number of days until the next Christmas day, i.e. the next time it will be December 25\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":2198,"title":"Find my birthday","description":"Given a birth date x, find my age when my birth day will fall on the same day as I was born. So if I was born on Monday, what age will I be when my birthday once again falls on a Monday.\r\nThere can be multiple outputs of this. You need to return first occurrence.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373.5px 8px; transform-origin: 373.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a birth date x, find my age when my birth day will fall on the same day as I was born. So if I was born on Monday, what age will I be when my birthday once again falls on a Monday.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 231px 8px; transform-origin: 231px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThere can be multiple outputs of this. You need to return first occurrence.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function age = FindMyBday(x)\r\n  age= 100;\r\nend","test_suite":"%%\r\nx = '01-Jan-1990';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '04-Sep-1985';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '01-Aug-2000';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '26-Jun-2012';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '16-Jun-1983';\r\ny_correct = 5;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":2,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":104,"test_suite_updated_at":"2022-01-27T15:01:09.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-18T20:51:55.000Z","updated_at":"2026-01-13T20:46:15.000Z","published_at":"2014-02-18T20:52:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a birth date x, find my age when my birth day will fall on the same day as I was born. So if I was born on Monday, what age will I be when my birthday once again falls on a Monday.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere can be multiple outputs of this. You need to return first occurrence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2454,"title":"birthday on same day of week","description":"Say, Mr. X's birthday is on 20th July, 2014. It was Sunday. Determine the closest year when his birthday will again be on Sunday. In this case it is, 2025.\r\n\r\nInput is a date string representing Mr. X's birthday. Return the year as double.","description_html":"\u003cp\u003eSay, Mr. X's birthday is on 20th July, 2014. It was Sunday. Determine the closest year when his birthday will again be on Sunday. In this case it is, 2025.\u003c/p\u003e\u003cp\u003eInput is a date string representing Mr. X's birthday. Return the year as double.\u003c/p\u003e","function_template":"function [yeah] = birthDay(date)\r\n\r\n% date will be on 'mm-dd-yyyy' format","test_suite":"%%\r\n% mm-dd-yyyy format\r\n%%\r\nassert(isequal(birthDay('7-20-2014'),2025));\r\n\r\n%%\r\nassert(isequal(birthDay('5-6-2014'),2025));\r\n\r\n%%\r\nassert(isequal(birthDay('1-1-2013'),2019));\r\n\r\n%%\r\nassert(isequal(birthDay('5-1-2010'),2021));\r\n\r\n%%\r\nassert(isequal(birthDay('11-4-1989'),1995));","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":82,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-20T07:31:12.000Z","updated_at":"2025-12-15T21:53:57.000Z","published_at":"2014-07-20T07:31:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eSay, Mr. X's birthday is on 20th July, 2014. It was Sunday. Determine the closest year when his birthday will again be on Sunday. In this case it is, 2025.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput is a date string representing Mr. X's birthday. Return the year as double.\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":2639,"title":"How Many Months Until It's Today Again?","description":"Given a particular date, calculate how many months must pass before that same day of the month occurs on the same day of the week.\r\n\r\nStart with 22-Oct-2014, which is a Wednesday. How many months must pass before the 22nd of the month occurs on a Wednesday again? Answer: You have to wait for six months. 22-Apr-2015 is also a Wednesday.\r\n\r\n\r\n*Example*\r\n\r\n d_in = '22-Oct-2014'\r\n wait_in_months = 6\r\n\r\n*Feature Tip*\r\n\r\nThis problem is made simpler by the \u003chttp://www.mathworks.com/help/matlab/date-and-time-operations.html DATETIME objects\u003e found in MATLAB \u003chttps://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2014b\u0026endrelease=R2014b\u0026groupby=release\u0026sortby=descending Release 2014b\u003e and later.\r\n\r\n\r\n\r\n","description_html":"\u003cp\u003eGiven a particular date, calculate how many months must pass before that same day of the month occurs on the same day of the week.\u003c/p\u003e\u003cp\u003eStart with 22-Oct-2014, which is a Wednesday. How many months must pass before the 22nd of the month occurs on a Wednesday again? Answer: You have to wait for six months. 22-Apr-2015 is also a Wednesday.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e d_in = '22-Oct-2014'\r\n wait_in_months = 6\u003c/pre\u003e\u003cp\u003e\u003cb\u003eFeature Tip\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis problem is made simpler by the \u003ca href = \"http://www.mathworks.com/help/matlab/date-and-time-operations.html\"\u003eDATETIME objects\u003c/a\u003e found in MATLAB \u003ca href = \"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2014b\u0026endrelease=R2014b\u0026groupby=release\u0026sortby=descending\"\u003eRelease 2014b\u003c/a\u003e and later.\u003c/p\u003e","function_template":"function wait_in_months = monthsUntilMatch(d_in)\r\n  wait_in_months = 0;\r\nend","test_suite":"%%\r\nd_in = '22-Oct-2014';\r\nm_correct = 6;\r\nm_test    = monthsUntilMatch(d_in);\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '2-Jul-2014';\r\nm_correct = 14;\r\nm_test    = monthsUntilMatch(d_in);\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '12-May-2011';\r\nm_correct = 8;\r\nm_test    = monthsUntilMatch(d_in);\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '14-Jul-1789';\r\nm_correct = 14;\r\nm_test    = monthsUntilMatch(d_in)\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '31-Dec-1999';\r\nm_correct = 3;\r\nm_test    = monthsUntilMatch(d_in)\r\nassert(isequal(m_test,m_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":131,"test_suite_updated_at":"2014-10-22T21:23:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-10-22T21:05:30.000Z","updated_at":"2026-01-05T00:04:16.000Z","published_at":"2014-10-22T21:23:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a particular date, calculate how many months must pass before that same day of the month occurs on the same day of the week.\u003c/w:t\u003e\u003c/w:r\u003e\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\u003eStart with 22-Oct-2014, which is a Wednesday. How many months must pass before the 22nd of the month occurs on a Wednesday again? Answer: You have to wait for six months. 22-Apr-2015 is also a Wednesday.\u003c/w:t\u003e\u003c/w:r\u003e\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ d_in = '22-Oct-2014'\\n wait_in_months = 6]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFeature Tip\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is made simpler by the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/matlab/date-and-time-operations.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDATETIME objects\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e found in MATLAB\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026amp;startrelease=R2014b\u0026amp;endrelease=R2014b\u0026amp;groupby=release\u0026amp;sortby=descending\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRelease 2014b\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and later.\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":1039,"title":"Get an array of month-ends in a date range","description":"Create a function that would return a list of month-ends falling in a given date range. \r\nIf a start date or end date falls on a month-end, that date should be included in the output (close ended range) \r\n\r\nFor example: \r\n  \r\n  date_start = datenum('10 Nov 2010');\r\n  date_end   = datenum('10 Feb 2011');\r\n  dates_me   = month_ends(date_start, date_end); \r\n  datestr(dates_me)\r\n    \r\n  ans =\r\n    \r\n  30-Nov-2010\r\n  31-Dec-2010\r\n  31-Jan-2011\r\n\r\n  \r\n\r\n","description_html":"\u003cp\u003eCreate a function that would return a list of month-ends falling in a given date range. \r\nIf a start date or end date falls on a month-end, that date should be included in the output (close ended range)\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edate_start = datenum('10 Nov 2010');\r\ndate_end   = datenum('10 Feb 2011');\r\ndates_me   = month_ends(date_start, date_end); \r\ndatestr(dates_me)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eans =\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e30-Nov-2010\r\n31-Dec-2010\r\n31-Jan-2011\r\n\u003c/pre\u003e","function_template":"function y = month_ends(date_start,date_end)\r\n  y = eomdate(date_start);\r\nend","test_suite":"%%\r\nd1 = datenum('10-Nov-2010');\r\nd2 = datenum('10-Feb-2011');\r\ny_correct = datenum({'30-Nov-2010','31-Dec-2010','31-Jan-2011'});\r\nassert(isequal(month_ends(d1,d2),y_correct))\r\n%%\r\n\r\nd1 = datenum('31-Jan-2000');\r\nd2 = datenum('10-Apr-2000');\r\ny_correct = datenum({'31-Jan-2000','29-Feb-2000','31-Mar-2000'});\r\nassert(isequal(month_ends(d1,d2),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":8363,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":117,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-11-19T15:21:20.000Z","updated_at":"2026-02-15T11:36:16.000Z","published_at":"2012-11-19T15:36:36.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eCreate a function that would return a list of month-ends falling in a given date range. If a start date or end date falls on a month-end, that date should be included in the output (close ended range)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[date_start = datenum('10 Nov 2010');\\ndate_end   = datenum('10 Feb 2011');\\ndates_me   = month_ends(date_start, date_end); \\ndatestr(dates_me)\\n\\nans =\\n\\n30-Nov-2010\\n31-Dec-2010\\n31-Jan-2011]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":2362,"title":"What day is it?","description":"Tell me what day is it. Return the full name of the day of the week as a string.\r\n\r\ne.g. It's June 12th 2014, so your function should return 'Thursday'","description_html":"\u003cp\u003eTell me what day is it. Return the full name of the day of the week as a string.\u003c/p\u003e\u003cp\u003ee.g. It's June 12th 2014, so your function should return 'Thursday'\u003c/p\u003e","function_template":"function y = day_of_week()\r\ny = 'Friday';\r\nend","test_suite":"%%\r\ntoday = java.util.Date;\r\nc = java.util.Calendar.getInstance();\r\nc.setTime( today );\r\ndayOfWeek = c.get(java.util.Calendar.DAY_OF_WEEK);\r\nswitch dayOfWeek\r\n    case 1\r\n        dayOfWeek = 'Sunday';    \r\n    case 2\r\n        dayOfWeek = 'Monday';\r\n    case 3\r\n        dayOfWeek = 'Tuesday';\r\n    case 4\r\n        dayOfWeek = 'Wednesday';\r\n    case 5\r\n        dayOfWeek = 'Thursday';\r\n    case 6\r\n        dayOfWeek = 'Friday';\r\n    case 7\r\n        dayOfWeek = 'Saturday';\r\nend\r\nassert(strcmp(dayOfWeek,day_of_week()))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":450,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":222,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-06-12T20:06:06.000Z","updated_at":"2026-03-12T20:06:11.000Z","published_at":"2014-06-13T14:20:59.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\u003eTell me what day is it. Return the full name of the day of the week as a 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ee.g. It's June 12th 2014, so your function should return 'Thursday'\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":42711,"title":"Find Month \u0026 day for given day number of a year ","description":"Find Month \u0026 day for given day number of a year  (day number is any number ranging from 1 to 366)","description_html":"\u003cp\u003eFind Month \u0026 day for given day number of a year  (day number is any number ranging from 1 to 366)\u003c/p\u003e","function_template":"function vec = your_fcn_name(x)\r\n%%logic\r\nend","test_suite":"%%\r\nx = 23;\r\nvec_crt=[1 23];\r\nassert(isequal(your_fcn_name(x),vec_crt))\r\n%%\r\nx = 54;\r\nvec_crt=[2 23];\r\nassert(isequal(your_fcn_name(x),vec_crt))\r\n%%\r\nx = 231;\r\nvec_crt=[8 18];\r\nassert(isequal(your_fcn_name(x),vec_crt))\r\n%%\r\nx = 300;\r\nvec_crt=[10 26];\r\nassert(isequal(your_fcn_name(x),vec_crt))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":46868,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":96,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-01-15T06:34:44.000Z","updated_at":"2026-01-05T00:10:53.000Z","published_at":"2016-01-15T06:48:57.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\u003eFind Month \u0026amp; day for given day number of a year (day number is any number ranging from 1 to 366)\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":43612,"title":"time of day","description":"Calculate the time of day in days, hours, minutes or seconds passed since the beginning of the day, depending on the unit. The unit is given as a string: \r\n\r\n  validUnits = {'nanoseconds'; 'microseconds'; 'milliseconds'; ...\r\n  'seconds'; 'minutes'; 'hours'; 'days'};","description_html":"\u003cp\u003eCalculate the time of day in days, hours, minutes or seconds passed since the beginning of the day, depending on the unit. The unit is given as a string:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003evalidUnits = {'nanoseconds'; 'microseconds'; 'milliseconds'; ...\r\n'seconds'; 'minutes'; 'hours'; 'days'};\r\n\u003c/pre\u003e","function_template":"function y = timeOfDay(x, unit)\r\n  y = 1;\r\nend","test_suite":"%%\r\nx = '12-Jan-2000 00:06:16';\r\ny_correct = 376 * 1e9;\r\nunits = 'nanoseconds';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '12-Jan-2000 00:06:16';\r\ny_correct = 0.10444444;\r\nunits = 'hours';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '11-Nov-1911 11:11:11';\r\ny_correct = 40271;\r\nunits = 'seconds';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '11-Nov-1911 11:11:11';\r\ny_correct = 0.4660995;\r\nunits = 'days';\r\nassert(abs(timeOfDay(x, units) - y_correct) / y_correct \u003c 1e-3)\r\n\r\n%%\r\nx = '24-Oct-2016 20:26:28';\r\ny_correct = [73588*1e9 73588*1e6 73588000 ...\r\n    73588 1226.4667 20.441111 0.85171296];\r\nunits = {'nanoseconds', 'microseconds', 'milliseconds',...\r\n    'seconds', 'minutes', 'hours', 'days'};\r\nfor i = 1:numel(y_correct)\r\n    assert(abs(timeOfDay(x, units{i}) - y_correct(i)) / y_correct(i) \u003c 1e-3)\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":"2016-12-06T18:54:26.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T19:04:23.000Z","updated_at":"2025-12-31T13:52:42.000Z","published_at":"2016-10-24T19:04:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCalculate the time of day in days, hours, minutes or seconds passed since the beginning of the day, depending on the unit. The unit is given as a string:\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[validUnits = {'nanoseconds'; 'microseconds'; 'milliseconds'; ...\\n'seconds'; 'minutes'; 'hours'; 'days'};]]\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":720,"title":"Find number of days","description":"The input is two date in string format (dd-mm-yyyy)\r\n\r\nfind out the number of days between these two dates.\r\nExample:\r\n\r\ninput: '15-jan-2000' '24-may-2012'\r\n\r\n(if today is 24-may-2012)\r\n\r\noutput: 4509","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 171px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 85.5px; transform-origin: 407px 85.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 336.5px 8px; transform-origin: 336.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe input is two date in string format (dd-mm-yyyy), Find out the number of days between these two dates. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 30.5px 8px; transform-origin: 30.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample: \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 108px 8px; transform-origin: 108px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003einput: '15-jan-2000' '24-may-2012'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 79px 8px; transform-origin: 79px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e(if today is 24-may-2012)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40px 8px; transform-origin: 40px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eoutput: 4509\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = countDays(x1,x2)\r\n","test_suite":"%%\r\nx1 = '15-jan-2000';\r\nx2 = '24-may-2012';\r\ny_correct = 4513;\r\nassert(isequal(countDays(x1,x2),y_correct))\r\n\r\n%%\r\nx1 = '15-jan-1000';\r\nx2 = '24-may-2012';\r\ny_correct =  369755;\r\nassert(isequal(countDays(x1,x2),y_correct))\r\n\r\n%%\r\nx1 = '24-may-2013';\r\nx2 = '24-may-2012';\r\ny_correct =  365;\r\nassert(isequal(countDays(x1,x2),y_correct))\r\n\r\n%%\r\nx1 = '30-apr-2021';\r\nx2 = '30-apr-2021';\r\nassert(isequal(countDays(x1,x2),0))","published":true,"deleted":false,"likes_count":0,"comments_count":7,"created_by":4320,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":238,"test_suite_updated_at":"2021-04-19T08:49:24.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2012-05-24T12:45:19.000Z","updated_at":"2026-01-05T00:22:17.000Z","published_at":"2012-05-24T12:49:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe input is two date in string format (dd-mm-yyyy), Find out the number of days between these two dates. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample: \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003einput: '15-jan-2000' '24-may-2012'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(if today is 24-may-2012)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput: 4509\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43275,"title":"calculate the day of the year from a date string.","description":"'09-Oct-2016' is the 283rd day of the year.\r\nSo\r\n\r\n  doy = dayoftheyear('09-Oct-2016')\r\n\r\nshould return\r\n\r\n  doy = 283","description_html":"\u003cp\u003e'09-Oct-2016' is the 283rd day of the year.\r\nSo\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edoy = dayoftheyear('09-Oct-2016')\r\n\u003c/pre\u003e\u003cp\u003eshould return\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edoy = 283\r\n\u003c/pre\u003e","function_template":"function doy = dayoftheyear(date)\r\n  doy = 283;\r\nend","test_suite":"%%\r\nstart = '09-Oct-2016';\r\nfor i = 1:10\r\n    date = datestr(datenum(start) + i);\r\n    doy_correct = 283 + i;\r\n    doy = dayoftheyear(date);\r\n    assert(isequal(doy, doy_correct));\r\nend\r\nstart = '04-Oct-1937';\r\nfor i = 1:10\r\n    date = datestr(datenum(start) + i);\r\n    doy_correct = 277 + i;\r\n    doy = dayoftheyear(date);\r\n    assert(isequal(doy, doy_correct));\r\nend","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":128,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-09T11:24:48.000Z","updated_at":"2026-01-04T23:58:05.000Z","published_at":"2016-10-09T11:24:48.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\u003e'09-Oct-2016' is the 283rd day of the year. So\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[doy = dayoftheyear('09-Oct-2016')]]\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\u003eshould return\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[doy = 283]]\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":43611,"title":"microseconds passed today","description":"Calculate the amount of microseconds passed for a given date string. Return the value, rounded to the nearest integer, as a string.","description_html":"\u003cp\u003eCalculate the amount of microseconds passed for a given date string. Return the value, rounded to the nearest integer, as a string.\u003c/p\u003e","function_template":"function y = microsecondsPassedToday(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = '24-Oct-2016 20:26:28';\r\ny_correct = '73588000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '24-Oct-2016 20:29:48';\r\ny_correct = '73788000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '14-Feb-2002 08:19:04';\r\ny_correct = '29944000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '07-Apr-1902 10:00:00';\r\ny_correct = '36000000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))\r\n\r\n%%\r\nx = '11-Nov-1911 11:11:11';\r\ny_correct = '40271000000';\r\nassert(isequal(microsecondsPassedToday(x),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":85,"test_suite_updated_at":"2016-12-05T19:16:06.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T18:40:02.000Z","updated_at":"2026-01-04T23:59:11.000Z","published_at":"2016-10-24T18:40:02.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eCalculate the amount of microseconds passed for a given date string. Return the value, rounded to the nearest integer, as a string.\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":2196,"title":"Tax Season ! How much is my salary?","description":"Tax Season! I was employed for a period from x until y in a year and I get pay check of amount z on every alternate Friday of the week starting from first Friday since I am employed. Help me find out how much did I earn during my employment period.\r\n\r\nExample\r\n\r\n x = 01-Jan-2014\r\n y = 14-Feb-2014\r\n z = $2000 (x will always be \u003cy)\r\n\r\nThis period has total 4 alternate Fridays which were my \"pay-days\", so the salary for this period was 4*2000 = %8000\r\n\r\n","description_html":"\u003cp\u003eTax Season! I was employed for a period from x until y in a year and I get pay check of amount z on every alternate Friday of the week starting from first Friday since I am employed. Help me find out how much did I earn during my employment period.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e x = 01-Jan-2014\r\n y = 14-Feb-2014\r\n z = $2000 (x will always be \u0026lt;y)\u003c/pre\u003e\u003cp\u003eThis period has total 4 alternate Fridays which were my \"pay-days\", so the salary for this period was 4*2000 = %8000\u003c/p\u003e","function_template":"function salary= AllAboutMoney_Honey(x,y,z)\r\nsalary = 0;\r\nend","test_suite":"%%\r\nx = '01-Jan-2014';\r\ny = '14-Feb-2014';\r\nz = 2000;\r\nsalary = 8000;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n\r\n%%\r\nx = '14-Feb-2013';\r\ny = '29-Apr-2013';\r\nz = 3599;\r\nsalary = 21594;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n\r\n%%\r\nx = '01-Jan-2012';\r\ny = '31-Dec-2012';\r\nz = 500;\r\nsalary = 13000;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n\r\n%%\r\nx = '13-Dec-2011';\r\ny = '28-Jan-2012';\r\nz = 654;\r\nsalary = 2616;\r\nassert(isequal(AllAboutMoney_Honey(x,y,z),salary))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":82,"test_suite_updated_at":"2014-02-18T17:46:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-18T17:13:55.000Z","updated_at":"2026-01-05T00:12:47.000Z","published_at":"2014-02-18T17:15:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTax Season! I was employed for a period from x until y in a year and I get pay check of amount z on every alternate Friday of the week starting from first Friday since I am employed. Help me find out how much did I earn during my employment period.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = 01-Jan-2014\\n y = 14-Feb-2014\\n z = $2000 (x will always be \u003cy)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis period has total 4 alternate Fridays which were my \\\"pay-days\\\", so the salary for this period was 4*2000 = %8000\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":216,"title":"Is this date a palindrome?emordnilap a etad siht sI","description":"Take a MATLAB date number as input, and return true if the date is a palindrome, false if the date is not a palindrome.  A date number is a scalar double representing the decimal days since Jan. 1, 0000 (type \"help datenum\").\r\n\r\nThe date shall be considered a palindrome if the \"mmddyy\" form of the date is a palindrome with leading zeros removed from months and days.  Thus, a date number of 706076 corresponds to March 3, 1933, which can be written 03/03/33.  Then the leading zeros are removed to get \"3333\" --\u003e true.  Date number 695118 corresponds to March 3, 1903, i.e. \"030303\" which reduces to \"3303\" --\u003e false.","description_html":"\u003cp\u003eTake a MATLAB date number as input, and return true if the date is a palindrome, false if the date is not a palindrome.  A date number is a scalar double representing the decimal days since Jan. 1, 0000 (type \"help datenum\").\u003c/p\u003e\u003cp\u003eThe date shall be considered a palindrome if the \"mmddyy\" form of the date is a palindrome with leading zeros removed from months and days.  Thus, a date number of 706076 corresponds to March 3, 1933, which can be written 03/03/33.  Then the leading zeros are removed to get \"3333\" --\u003e true.  Date number 695118 corresponds to March 3, 1903, i.e. \"030303\" which reduces to \"3303\" --\u003e false.\u003c/p\u003e","function_template":"function tf = isPalindrome(d)\r\n  tf = false;\r\nend","test_suite":"%%\r\nd = datenum('01-Jan-2011 02:02:02',0);\r\ntf = true;\r\nassert(isequal(isPalindrome(d),tf))\r\n\r\n%%\r\nd = datenum('02/01/12',2);\r\ntf = true;\r\nassert(isequal(isPalindrome(d),tf))\r\n\r\n%%\r\nd = datenum('12-Nov-1943',1);\r\ntf = false;\r\nassert(isequal(isPalindrome(d),tf))\r\n\r\n%%\r\nd = datenum('10/10/01',2);\r\ntf = false;\r\nassert(isequal(isPalindrome(d),tf))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":80,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":90,"test_suite_updated_at":"2018-08-30T16:48:29.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-01T16:08:32.000Z","updated_at":"2026-01-05T00:09:20.000Z","published_at":"2012-02-01T23:06:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTake a MATLAB date number as input, and return true if the date is a palindrome, false if the date is not a palindrome. A date number is a scalar double representing the decimal days since Jan. 1, 0000 (type \\\"help datenum\\\").\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe date shall be considered a palindrome if the \\\"mmddyy\\\" form of the date is a palindrome with leading zeros removed from months and days. Thus, a date number of 706076 corresponds to March 3, 1933, which can be written 03/03/33. Then the leading zeros are removed to get \\\"3333\\\" --\u003e true. Date number 695118 corresponds to March 3, 1903, i.e. \\\"030303\\\" which reduces to \\\"3303\\\" --\u003e false.\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":1044,"title":"Create a Cell array of month-end date strings within a date range","description":"This is a variation of \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range Get an array of month-ends by T.D.\u003e where the result is now a cell array of date strings.\r\n\r\nFor example:\r\n\r\n  date_start = datenum('10 Nov 2010');\r\n  date_end   = datenum('10 Feb 2011');\r\n  dates_me   = month_ends(date_start, date_end); \r\n  dates_me\r\n  dates_me = \r\n     '30-Nov-2010' '31-Dec-2010' '31-Jan-2011'\r\n  \r\nThis is the improved proper usage of Cell-array version of \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1040-create-a-cell-array-of-month-end-date-strings-within-a-provided-date-range Challenge 1040\u003e.\r\nThanks to J.G. for identifying the proper usage.\r\n\r\n","description_html":"\u003cp\u003eThis is a variation of \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range\"\u003eGet an array of month-ends by T.D.\u003c/a\u003e where the result is now a cell array of date strings.\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edate_start = datenum('10 Nov 2010');\r\ndate_end   = datenum('10 Feb 2011');\r\ndates_me   = month_ends(date_start, date_end); \r\ndates_me\r\ndates_me = \r\n   '30-Nov-2010' '31-Dec-2010' '31-Jan-2011'\r\n\u003c/pre\u003e\u003cp\u003eThis is the improved proper usage of Cell-array version of \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/1040-create-a-cell-array-of-month-end-date-strings-within-a-provided-date-range\"\u003eChallenge 1040\u003c/a\u003e.\r\nThanks to J.G. for identifying the proper usage.\u003c/p\u003e","function_template":"function y = month_ends(date_start,date_end)\r\n y{1}=datestr(date_start,'dd-mmm-yyyy');\r\n y{2}=datestr(date_start,'dd-mmm-yyyy');\r\n  \r\nend","test_suite":"%%\r\nd1 = datenum('10-Nov-2010');\r\nd2 = datenum('10-Feb-2011');\r\ny_correct = {'30-Nov-2010','31-Dec-2010','31-Jan-2011'};\r\ndates_me=month_ends(d1,d2)\r\nassert(isequal(dates_me,y_correct))\r\n\r\n%%\r\nd1 = datenum('31-Jan-2000');\r\nd2 = datenum('10-Apr-2000');\r\ny_correct = {'31-Jan-2000','29-Feb-2000','31-Mar-2000'};\r\ndates_me=month_ends(d1,d2)\r\nassert(isequal(dates_me,y_correct))\r\n\r\n%%\r\nd1 = datenum('05-Feb-2012');\r\nd2 = datenum('10-Jul-2012');\r\ny_correct = {'29-Feb-2012','31-Mar-2012','30-Apr-2012','31-May-2012','30-Jun-2012'};\r\n\r\ndates_me=month_ends(d1,d2)\r\nassert(isequal(dates_me,y_correct))\r\n\r\n","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":78,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-11-21T02:41:42.000Z","updated_at":"2026-01-05T00:12:04.000Z","published_at":"2012-11-21T02:45:43.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is a variation of\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/1039-get-an-array-of-month-ends-in-a-date-range\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGet an array of month-ends by T.D.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e where the result is now a cell array of date strings.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\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[date_start = datenum('10 Nov 2010');\\ndate_end   = datenum('10 Feb 2011');\\ndates_me   = month_ends(date_start, date_end); \\ndates_me\\ndates_me = \\n   '30-Nov-2010' '31-Dec-2010' '31-Jan-2011']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the improved proper usage of Cell-array version of\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/1040-create-a-cell-array-of-month-end-date-strings-within-a-provided-date-range\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eChallenge 1040\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Thanks to J.G. for identifying the proper usage.\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":43610,"title":"nanoseconds passed today","description":"Calculate the amount of nanoseconds passed in the current day of a certain date string.","description_html":"\u003cp\u003eCalculate the amount of nanoseconds passed in the current day of a certain date string.\u003c/p\u003e","function_template":"function y = nanosecondsPassedToday(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = '24-Oct-2016 20:26:28';\r\ny_correct = 73587999999895.69;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n\r\n%%\r\nx = '24-Oct-2016 20:29:48';\r\ny_correct = 73788000001385.8;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n\r\n%%\r\nx = '31-Oct-2016 13:19:42';\r\ny_correct = 47982000002637.5;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n\r\n%%\r\nx = '04-Jan-1972 07:24:17';\r\ny_correct = 26656999999657.3;\r\nassert(abs(nanosecondsPassedToday(x)-y_correct)\u003c0.05)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":9,"created_by":57323,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2016-12-05T18:57:37.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T18:32:01.000Z","updated_at":"2026-03-19T08:27:13.000Z","published_at":"2016-10-24T18:32:48.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\u003eCalculate the amount of nanoseconds passed in the current day of a certain date string.\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":42353,"title":"Can't wait for NewYear ball drop !","description":"Given an input string of the form 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss', return a string message indicating how many days, hours, minutes and seconds are left to the NewYear ball drop. Examples:\r\n\r\n  Input = '2014-05-26 10:15:45';\r\n  Output = '219 days, 13 hours, 44 minutes, 15 seconds to go.'\r\n  \r\n  Input = '2014-12-31 10:15:45';;\r\n  Output = '000 days, 13 hours, 44 minutes, 15 seconds to go.'","description_html":"\u003cp\u003eGiven an input string of the form 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss', return a string message indicating how many days, hours, minutes and seconds are left to the NewYear ball drop. Examples:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eInput = '2014-05-26 10:15:45';\r\nOutput = '219 days, 13 hours, 44 minutes, 15 seconds to go.'\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eInput = '2014-12-31 10:15:45';;\r\nOutput = '000 days, 13 hours, 44 minutes, 15 seconds to go.'\r\n\u003c/pre\u003e","function_template":"function y = CantWaitTillBallDrops(x)\r\n  y = '';\r\nend","test_suite":"%%\r\nx = '2014-12-31 10:15:45';\r\ny_correct = '000 days, 13 hours, 44 minutes, 15 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n%%\r\nx = '2014-05-26 10:15:45';\r\ny_correct = '219 days, 13 hours, 44 minutes, 15 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n%%\r\nx = '2015-12-30';\r\ny_correct = '002 days, 00 hours, 00 minutes, 00 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n%%\r\nx = '2015-05-26';\r\ny_correct = '220 days, 00 hours, 00 minutes, 00 seconds to go.';\r\nassert(isequal(CantWaitTillBallDrops(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":44306,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":"2015-06-02T19:06:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-06-02T18:55:35.000Z","updated_at":"2026-01-01T13:58:46.000Z","published_at":"2015-06-02T19:06:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven an input string of the form 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss', return a string message indicating how many days, hours, minutes and seconds are left to the NewYear ball drop. Examples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[Input = '2014-05-26 10:15:45';\\nOutput = '219 days, 13 hours, 44 minutes, 15 seconds to go.'\\n\\nInput = '2014-12-31 10:15:45';;\\nOutput = '000 days, 13 hours, 44 minutes, 15 seconds to go.']]\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":2524,"title":"weekday and month ","description":"Given a year and a weekday, determine how many months of that year had five of those weekdays. It is kind of easy to find.\r\nExample:\r\ny = 2014\r\nd = 'Sun'\r\n\r\nresult = 4","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 163.733px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 81.8667px; transform-origin: 407px 81.8667px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 237.5px 8px; transform-origin: 237.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a year and a weekday, determine how many months of that year had \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 13.5px 8px; transform-origin: 13.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003efive\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 125px 8px; transform-origin: 125px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e of those weekdays. It is kind of easy to find.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 28.5px 8px; transform-origin: 28.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 32px 8.5px; tab-size: 4; transform-origin: 32px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ey = 2014\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 36px 8.5px; tab-size: 4; transform-origin: 36px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 16px 8.5px; transform-origin: 16px 8.5px; \"\u003ed = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e'Sun'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 40px 8.5px; tab-size: 4; transform-origin: 40px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003eresult = 4\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = dd(year,day)\r\n  y = x;\r\nend","test_suite":"%%\r\nyear = 2014;\r\nday = 'Sun'\r\ny_correct = 4;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2014;\r\nday = 'Wed'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2025;\r\nday = 'Mon'\r\ny_correct = 4;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 1999;\r\nday = 'Fri'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2020;\r\nday = 'Thu'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2000;\r\nday = 'Sat'\r\ny_correct = 5;\r\nassert(isequal(dd(year,day),y_correct))\r\n\r\n%%\r\nyear = 2022;\r\nday = 'Tue'\r\ny_correct = 4;\r\nassert(isequal(dd(year,day),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":71,"test_suite_updated_at":"2022-01-28T09:58:21.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-08-20T10:55:40.000Z","updated_at":"2026-01-05T00:00:24.000Z","published_at":"2014-08-20T10:55:40.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a year and a weekday, determine how many months of that year had \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efive\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of those weekdays. It is kind of easy to find.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[y = 2014\\nd = 'Sun'\\n\\nresult = 4]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45207,"title":"Calculate days until Christmas","description":"Provided with inputs year, month, day e.g. 2019,11,12, calculate the number of days until the next Christmas day, i.e. the next time it will be December 25","description_html":"\u003cp\u003eProvided with inputs year, month, day e.g. 2019,11,12, calculate the number of days until the next Christmas day, i.e. the next time it will be December 25\u003c/p\u003e","function_template":"function num = daysUntilChristmas(y,m,d)\r\n  num = 0;\r\nend","test_suite":"%%\r\nassert(isequal(daysUntilChristmas(2019,11,19),36))\r\n%%\r\nassert(isequal(daysUntilChristmas(2018,12,28),362))\r\n%%\r\nassert(isequal(daysUntilChristmas(2019,01,01),358))\r\n%%\r\nassert(isequal(daysUntilChristmas(2019,12,30),361))","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":348097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":350,"test_suite_updated_at":"2019-11-19T16:17:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-19T16:06:18.000Z","updated_at":"2026-04-01T08:10:22.000Z","published_at":"2019-11-19T16:17:03.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\u003eProvided with inputs year, month, day e.g. 2019,11,12, calculate the number of days until the next Christmas day, i.e. the next time it will be December 25\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":2198,"title":"Find my birthday","description":"Given a birth date x, find my age when my birth day will fall on the same day as I was born. So if I was born on Monday, what age will I be when my birthday once again falls on a Monday.\r\nThere can be multiple outputs of this. You need to return first occurrence.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 373.5px 8px; transform-origin: 373.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a birth date x, find my age when my birth day will fall on the same day as I was born. So if I was born on Monday, what age will I be when my birthday once again falls on a Monday.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 231px 8px; transform-origin: 231px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThere can be multiple outputs of this. You need to return first occurrence.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function age = FindMyBday(x)\r\n  age= 100;\r\nend","test_suite":"%%\r\nx = '01-Jan-1990';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '04-Sep-1985';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '01-Aug-2000';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '26-Jun-2012';\r\ny_correct = 6;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n%%\r\nx = '16-Jun-1983';\r\ny_correct = 5;\r\nassert(isequal(FindMyBday(x),y_correct))\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":2,"created_by":16381,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":104,"test_suite_updated_at":"2022-01-27T15:01:09.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-18T20:51:55.000Z","updated_at":"2026-01-13T20:46:15.000Z","published_at":"2014-02-18T20:52:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a birth date x, find my age when my birth day will fall on the same day as I was born. So if I was born on Monday, what age will I be when my birthday once again falls on a Monday.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere can be multiple outputs of this. You need to return first occurrence.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2454,"title":"birthday on same day of week","description":"Say, Mr. X's birthday is on 20th July, 2014. It was Sunday. Determine the closest year when his birthday will again be on Sunday. In this case it is, 2025.\r\n\r\nInput is a date string representing Mr. X's birthday. Return the year as double.","description_html":"\u003cp\u003eSay, Mr. X's birthday is on 20th July, 2014. It was Sunday. Determine the closest year when his birthday will again be on Sunday. In this case it is, 2025.\u003c/p\u003e\u003cp\u003eInput is a date string representing Mr. X's birthday. Return the year as double.\u003c/p\u003e","function_template":"function [yeah] = birthDay(date)\r\n\r\n% date will be on 'mm-dd-yyyy' format","test_suite":"%%\r\n% mm-dd-yyyy format\r\n%%\r\nassert(isequal(birthDay('7-20-2014'),2025));\r\n\r\n%%\r\nassert(isequal(birthDay('5-6-2014'),2025));\r\n\r\n%%\r\nassert(isequal(birthDay('1-1-2013'),2019));\r\n\r\n%%\r\nassert(isequal(birthDay('5-1-2010'),2021));\r\n\r\n%%\r\nassert(isequal(birthDay('11-4-1989'),1995));","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":82,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-20T07:31:12.000Z","updated_at":"2025-12-15T21:53:57.000Z","published_at":"2014-07-20T07:31:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eSay, Mr. X's birthday is on 20th July, 2014. It was Sunday. Determine the closest year when his birthday will again be on Sunday. In this case it is, 2025.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput is a date string representing Mr. X's birthday. Return the year as double.\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":2639,"title":"How Many Months Until It's Today Again?","description":"Given a particular date, calculate how many months must pass before that same day of the month occurs on the same day of the week.\r\n\r\nStart with 22-Oct-2014, which is a Wednesday. How many months must pass before the 22nd of the month occurs on a Wednesday again? Answer: You have to wait for six months. 22-Apr-2015 is also a Wednesday.\r\n\r\n\r\n*Example*\r\n\r\n d_in = '22-Oct-2014'\r\n wait_in_months = 6\r\n\r\n*Feature Tip*\r\n\r\nThis problem is made simpler by the \u003chttp://www.mathworks.com/help/matlab/date-and-time-operations.html DATETIME objects\u003e found in MATLAB \u003chttps://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2014b\u0026endrelease=R2014b\u0026groupby=release\u0026sortby=descending Release 2014b\u003e and later.\r\n\r\n\r\n\r\n","description_html":"\u003cp\u003eGiven a particular date, calculate how many months must pass before that same day of the month occurs on the same day of the week.\u003c/p\u003e\u003cp\u003eStart with 22-Oct-2014, which is a Wednesday. How many months must pass before the 22nd of the month occurs on a Wednesday again? Answer: You have to wait for six months. 22-Apr-2015 is also a Wednesday.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e d_in = '22-Oct-2014'\r\n wait_in_months = 6\u003c/pre\u003e\u003cp\u003e\u003cb\u003eFeature Tip\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis problem is made simpler by the \u003ca href = \"http://www.mathworks.com/help/matlab/date-and-time-operations.html\"\u003eDATETIME objects\u003c/a\u003e found in MATLAB \u003ca href = \"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2014b\u0026endrelease=R2014b\u0026groupby=release\u0026sortby=descending\"\u003eRelease 2014b\u003c/a\u003e and later.\u003c/p\u003e","function_template":"function wait_in_months = monthsUntilMatch(d_in)\r\n  wait_in_months = 0;\r\nend","test_suite":"%%\r\nd_in = '22-Oct-2014';\r\nm_correct = 6;\r\nm_test    = monthsUntilMatch(d_in);\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '2-Jul-2014';\r\nm_correct = 14;\r\nm_test    = monthsUntilMatch(d_in);\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '12-May-2011';\r\nm_correct = 8;\r\nm_test    = monthsUntilMatch(d_in);\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '14-Jul-1789';\r\nm_correct = 14;\r\nm_test    = monthsUntilMatch(d_in)\r\nassert(isequal(m_test,m_correct))\r\n\r\n%%\r\nd_in = '31-Dec-1999';\r\nm_correct = 3;\r\nm_test    = monthsUntilMatch(d_in)\r\nassert(isequal(m_test,m_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":131,"test_suite_updated_at":"2014-10-22T21:23:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-10-22T21:05:30.000Z","updated_at":"2026-01-05T00:04:16.000Z","published_at":"2014-10-22T21:23:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a particular date, calculate how many months must pass before that same day of the month occurs on the same day of the week.\u003c/w:t\u003e\u003c/w:r\u003e\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\u003eStart with 22-Oct-2014, which is a Wednesday. How many months must pass before the 22nd of the month occurs on a Wednesday again? Answer: You have to wait for six months. 22-Apr-2015 is also a Wednesday.\u003c/w:t\u003e\u003c/w:r\u003e\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ d_in = '22-Oct-2014'\\n wait_in_months = 6]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFeature Tip\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem is made simpler by the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/matlab/date-and-time-operations.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eDATETIME objects\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e found in MATLAB\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026amp;startrelease=R2014b\u0026amp;endrelease=R2014b\u0026amp;groupby=release\u0026amp;sortby=descending\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRelease 2014b\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and later.\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":1039,"title":"Get an array of month-ends in a date range","description":"Create a function that would return a list of month-ends falling in a given date range. \r\nIf a start date or end date falls on a month-end, that date should be included in the output (close ended range) \r\n\r\nFor example: \r\n  \r\n  date_start = datenum('10 Nov 2010');\r\n  date_end   = datenum('10 Feb 2011');\r\n  dates_me   = month_ends(date_start, date_end); \r\n  datestr(dates_me)\r\n    \r\n  ans =\r\n    \r\n  30-Nov-2010\r\n  31-Dec-2010\r\n  31-Jan-2011\r\n\r\n  \r\n\r\n","description_html":"\u003cp\u003eCreate a function that would return a list of month-ends falling in a given date range. \r\nIf a start date or end date falls on a month-end, that date should be included in the output (close ended range)\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edate_start = datenum('10 Nov 2010');\r\ndate_end   = datenum('10 Feb 2011');\r\ndates_me   = month_ends(date_start, date_end); \r\ndatestr(dates_me)\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eans =\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e30-Nov-2010\r\n31-Dec-2010\r\n31-Jan-2011\r\n\u003c/pre\u003e","function_template":"function y = month_ends(date_start,date_end)\r\n  y = eomdate(date_start);\r\nend","test_suite":"%%\r\nd1 = datenum('10-Nov-2010');\r\nd2 = datenum('10-Feb-2011');\r\ny_correct = datenum({'30-Nov-2010','31-Dec-2010','31-Jan-2011'});\r\nassert(isequal(month_ends(d1,d2),y_correct))\r\n%%\r\n\r\nd1 = datenum('31-Jan-2000');\r\nd2 = datenum('10-Apr-2000');\r\ny_correct = datenum({'31-Jan-2000','29-Feb-2000','31-Mar-2000'});\r\nassert(isequal(month_ends(d1,d2),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":8363,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":117,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-11-19T15:21:20.000Z","updated_at":"2026-02-15T11:36:16.000Z","published_at":"2012-11-19T15:36:36.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eCreate a function that would return a list of month-ends falling in a given date range. If a start date or end date falls on a month-end, that date should be included in the output (close ended range)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[date_start = datenum('10 Nov 2010');\\ndate_end   = datenum('10 Feb 2011');\\ndates_me   = month_ends(date_start, date_end); \\ndatestr(dates_me)\\n\\nans =\\n\\n30-Nov-2010\\n31-Dec-2010\\n31-Jan-2011]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"group:\"Date \u0026 Time I\"","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":"group:\"Date \u0026 Time I\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"group":[["group:\"Date \u0026 Time I\"","","\"","Date \u0026 Time I","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fac4738b698\u003e":["Date \u0026 Time I"],"#\u003cMathWorks::Search::Field:0x00007fac4738b5f8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fac4738abf8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fac4738ba58\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fac4738b9b8\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fac4738b878\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fac4738b738\u003e":"group:\"Date \u0026 Time I\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fac4738b738\u003e":"group:\"Date \u0026 Time I\""},"queried_facets":{"#\u003cMathWorks::Search::Field:0x00007fac4738b698\u003e":["Date \u0026 Time I"]}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"group:\"Date \u0026 Time I\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"group":[["group:\"Date \u0026 Time I\"","","\"","Date \u0026 Time I","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fac4738b698\u003e":["Date \u0026 Time I"],"#\u003cMathWorks::Search::Field:0x00007fac4738b5f8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fac4738abf8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fac4738ba58\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fac4738b9b8\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fac4738b878\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fac4738b738\u003e":"group:\"Date \u0026 Time I\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fac4738b738\u003e":"group:\"Date \u0026 Time I\""},"queried_facets":{"#\u003cMathWorks::Search::Field:0x00007fac4738b698\u003e":["Date \u0026 Time I"]}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":2362,"difficulty_rating":"easy-medium"},{"id":42711,"difficulty_rating":"easy-medium"},{"id":43612,"difficulty_rating":"easy-medium"},{"id":720,"difficulty_rating":"easy-medium"},{"id":43275,"difficulty_rating":"easy-medium"},{"id":43611,"difficulty_rating":"easy-medium"},{"id":2196,"difficulty_rating":"easy-medium"},{"id":216,"difficulty_rating":"easy-medium"},{"id":1044,"difficulty_rating":"easy-medium"},{"id":43610,"difficulty_rating":"easy-medium"},{"id":42353,"difficulty_rating":"easy-medium"},{"id":2524,"difficulty_rating":"easy-medium"},{"id":45207,"difficulty_rating":"medium"},{"id":2198,"difficulty_rating":"medium"},{"id":2454,"difficulty_rating":"medium"},{"id":2639,"difficulty_rating":"medium"},{"id":1039,"difficulty_rating":"medium"}]}}