{"group":{"group":{"id":28,"name":"Strings II","lockable":false,"created_at":"2017-05-31T16:48:22.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"String together characters in the correct case.","is_default":false,"created_by":26769,"badge_id":42,"featured":false,"trending":false,"solution_count_in_trending_period":35,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":407,"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":"{\"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\u003eString together characters in the correct case.\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\"}]}","description_html":"\u003cdiv style = \"text-align: start; line-height: normal; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; perspective-origin: 289.5px 10.5px; transform-origin: 289.5px 10.5px; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; perspective-origin: 266.5px 10.5px; transform-origin: 266.5px 10.5px; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eString together characters in the correct case.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","published_at":"2019-05-08T19:56:48.000Z"},"current_player":null},"problems":[{"id":920,"title":"Eliminate Polysyllabics: Long live short words!","description":"Given a string s1, return s2 in which all the words with more than one syllable have been removed.\r\n\r\nTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\r\n\r\nSo these words are polysyllabic:\r\n\r\n ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS\r\n\r\nThese words are monosyllabic:\r\n\r\n STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE\r\n\r\nHere are some examples of one-syllable words that I WON'T use because they violate my rules:\r\n\r\n ONE ICED JUICE PLEASE\r\n\r\nAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\r\n\r\nExample:\r\n\r\n Input:  'The all day meetings will continue until we learn why productivity is so low'\r\n\r\n Output: 'The all day will we learn why is so low'","description_html":"\u003cp\u003eGiven a string s1, return s2 in which all the words with more than one syllable have been removed.\u003c/p\u003e\u003cp\u003eTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\u003c/p\u003e\u003cp\u003eSo these words are polysyllabic:\u003c/p\u003e\u003cpre\u003e ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS\u003c/pre\u003e\u003cp\u003eThese words are monosyllabic:\u003c/p\u003e\u003cpre\u003e STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE\u003c/pre\u003e\u003cp\u003eHere are some examples of one-syllable words that I WON'T use because they violate my rules:\u003c/p\u003e\u003cpre\u003e ONE ICED JUICE PLEASE\u003c/pre\u003e\u003cp\u003eAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input:  'The all day meetings will continue until we learn why productivity is so low'\u003c/pre\u003e\u003cpre\u003e Output: 'The all day will we learn why is so low'\u003c/pre\u003e","function_template":"function s2 = just_short_words(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'The all day meetings will continue until we learn why productivity is so low';\r\ns2_correct = 'The all day will we learn why is so low';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'I am perpetually perplexed my big brain notwithstanding';\r\ns2_correct = 'I am my big brain';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Lazy gravy calico sky ipso facto sweet potato pie';\r\ns2_correct = 'sky sweet pie';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":150,"test_suite_updated_at":"2012-12-21T22:37:32.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2012-08-23T14:29:37.000Z","updated_at":"2026-02-02T20:02:03.000Z","published_at":"2012-12-21T19:04:46.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 string s1, return s2 in which all the words with more than one syllable have been removed.\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\u003eTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\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\u003eSo these words are polysyllabic:\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[ ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS]]\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\u003eThese words are monosyllabic:\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[ STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE]]\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\u003eHere are some examples of one-syllable words that I WON'T use because they violate my rules:\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[ ONE ICED JUICE PLEASE]]\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\u003eAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\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[ Input:  'The all day meetings will continue until we learn why productivity is so low'\\n\\n Output: 'The all day will we learn why is so low']]\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":1303,"title":"Is the paranthesis sequence balanced ?","description":"Quantum mechanics and computer science are interested in bra-kets. Today however you, the player, will have to write a function to find if the given parenthesis expression is balanced.\r\ne.g.\r\n\u003e\u003e balance('(()()())')\r\n   1\r\n\r\n\u003e\u003e balance('(()()())(') \r\n   0\r\n\r\n\u003e\u003e balance('(())))()())')\r\n   0\r\n\r\n\u003e\u003e balance('(((()))((())))')\r\n   1\r\nHint: consider using a stack. Review your basic data structures for ideas.","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: 337.767px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 168.883px; transform-origin: 407px 168.883px; 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: 189.5px 8px; transform-origin: 189.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eQuantum mechanics and computer science are interested in\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ebra-kets\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 163px 8px; transform-origin: 163px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Today however you, the player, will have to write a function to find if the given parenthesis expression is balanced.\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: 12px 8px; transform-origin: 12px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ee.g.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 224.767px; 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 112.383px; transform-origin: 404px 112.383px; 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: 88px 8.5px; tab-size: 4; transform-origin: 88px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 40px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 40px 8.5px; \"\u003e'(()()())'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   1\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: 96px 8.5px; tab-size: 4; transform-origin: 96px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 44px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 44px 8.5px; \"\u003e'(()()())('\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 8px 8.5px; transform-origin: 8px 8.5px; \"\u003e) \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   0\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: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 52px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 52px 8.5px; \"\u003e'(())))()())'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   0\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: 112px 8.5px; tab-size: 4; transform-origin: 112px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 64px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 64px 8.5px; \"\u003e'(((()))((())))'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   1\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 129px 8px; transform-origin: 129px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHint: consider using a stack. Review your\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ebasic data structures\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 31.5px 8px; transform-origin: 31.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for ideas.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = balance_parens(x)\r\n  stack = [];\r\n  y = x;\r\nend\r\n","test_suite":"%%\r\nassert(isequal(balance_parens('(((()))((())))'),1))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()())'),1))\r\n\r\n%%\r\nassert(isequal(balance_parens(['(()()()()()()()()()()()())']),1))\r\n\r\n%%\r\nassert(isequal(balance_parens(')('),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()()))))'),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()(((((((((((()))))'),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('))()())'),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()()()((()))()()()(((()))))'),1))\r\n\r\n%%\r\nassert(isequal(balance_parens('((((()))))'),1))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":11,"created_by":3378,"edited_by":223089,"edited_at":"2022-10-19T14:45:58.000Z","deleted_by":null,"deleted_at":null,"solvers_count":200,"test_suite_updated_at":"2022-10-19T14:45:58.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-02-27T01:52:24.000Z","updated_at":"2026-04-02T18:55:37.000Z","published_at":"2013-02-27T02:03:15.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eQuantum mechanics and computer science are interested in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ebra-kets\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Today however you, the player, will have to write a function to find if the given parenthesis expression is balanced.\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.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[\u003e\u003e balance('(()()())')\\n   1\\n\\n\u003e\u003e balance('(()()())(') \\n   0\\n\\n\u003e\u003e balance('(())))()())')\\n   0\\n\\n\u003e\u003e balance('(((()))((())))')\\n   1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: consider using a stack. Review your\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ebasic data structures\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for ideas.\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":2140,"title":"Alternately upper-lower case","description":"Modify the string to alternate between upper and lower case. For example,\r\n s='achyuta'\r\n output='AcHyUtA'\r\n\r\nUpdate - Test cases added at 09-09-2022","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: 132.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 66.4333px; transform-origin: 407px 66.4333px; 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: 233.5px 8px; transform-origin: 233.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eModify the string to alternate between upper and lower case. For example,\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; 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 20.4333px; transform-origin: 404px 20.4333px; 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: 48px 8.5px; tab-size: 4; transform-origin: 48px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 12px 8.5px; transform-origin: 12px 8.5px; \"\u003e s=\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: 36px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 36px 8.5px; \"\u003e'achyuta'\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: 68px 8.5px; tab-size: 4; transform-origin: 68px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003e output=\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: 36px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 36px 8.5px; \"\u003e'AcHyUtA'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\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: 131.5px 8px; transform-origin: 131.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eUpdate - Test cases added at 09-09-2022\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = altul(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'gopala';\r\ny_correct = 'GoPaLa';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'adhisesa';\r\ny_correct = 'AdHiSeSa';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'Borderline';\r\ny_correct = 'BoRdErLiNe';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'mAtLaB CoDy';\r\ny_correct = 'MaTlAb cOdY';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'Quadrillion';\r\ny_correct = 'QuAdRiLlIoN';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'i AM batMAN';\r\ny_correct = 'I Am bAtMaN';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'dinnertime';\r\ny_correct = 'DiNnErTiMe';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'bicycle';\r\ny_correct = 'BiCyClE';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'QUADRACEPS';\r\ny_correct = 'QuAdRaCePs';\r\nassert(isequal(altul(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":1690,"edited_by":223089,"edited_at":"2022-09-09T07:55:07.000Z","deleted_by":null,"deleted_at":null,"solvers_count":276,"test_suite_updated_at":"2022-09-09T07:53:39.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2014-01-31T02:58:23.000Z","updated_at":"2026-03-20T04:27:15.000Z","published_at":"2014-01-31T02:58:23.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eModify the string to alternate between upper and lower case. For 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[ s='achyuta'\\n output='AcHyUtA']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eUpdate - Test cases added at 09-09-2022\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":1696,"title":"Morse Code Generator! Try it!","description":"  .... . .-.. .-.. ---     . ...- . .-. -.-- --- -. . -.-.-- \r\n        .-.. . - ...       -.. ---       ... --- -- .       -- --- .-. ... .       -.-. --- -.. . -.-.--             .-- . .-.. .-..       - .... .. ...       -- --- .-. ... .       -.-. --- -.. .       --. . -. . .-. .- - --- .-.       ..- ... . ...       - .... .       .. -. - . .-. -. .- - .. --- -. .- .-..       ... - -.-- .-.. .       -- --- .-. ... .       -.-. --- -.. . .-.-.-             - .... .       .-.-.-       .- -. -..              -- .- -.- .       ..- .--.       .- .-.. .-..       - .... .       -.-. --- -.. . --..--       - .... . .-. .       .. ...       --- -. .       ... .--. .- -.-. .       - .... .- -       ... . .--. .- .-. .- - . ...       .-.. . - - . .-. ...       .- -. -..       .....       ... .--. .- -.-. . ...       - .... .- -       ... . .--. .- .-. .- - .       .-- --- .-. -.. ... .-.-.-             ... --- -- .       .--. ..- -. -.-. - ..- .- - .. --- -.       .. ...       ..- ... . -.. .-.-.- .-.-.- .-.-.-             --- - .... . .-.       - .... . -.       - .... .- - --..--       .- .-.. .-..       -.-- --- ..-       -. . . -..       - ---       -.. ---       .. ...       - .- -.- .       .. -.       ... --- -- .       - -.-- .--. .       --- ..-.       - . -..- -       .. -.       - .... .       ..-. --- .-. --       --- ..-.       .-       ... - .-. .. -. --.       .- -. -..       - ..- .-. -.       .. -       .. -. - ---       .-       -- --- .-. ... .       -.-. --- -.. .       .-.. .. -. .        -.-. .... .- .-.       -.-. .-.. .- ... ...  --..--       .- ...       - .... .       . -..- .- -- .--. .-.. .       -... . .-.. --- .--       ... .... --- .-- ...  \r\n  \r\n\r\n\r\n  \r\n\r\n  text = 'Morse code is FUN!'\r\n  Morse_code_out = '-- --- .-. ... .       -.-. --- -.. .       .. ...       ..-. ..- -. -.-.--'\r\n\r\n\r\nJust a note: this uses international style Morse code found in:\r\n\r\nhttp://en.wikipedia.org/wiki/American_Morse_code\r\n","description_html":"\u003cpre class=\"language-matlab\"\u003e.... . .-.. .-.. ---     . ...- . .-. -.-- --- -. . -.-.-- \r\n      .-.. . - ...       -.. ---       ... --- -- .       -- --- .-. ... .       -.-. --- -.. . -.-.--             .-- . .-.. .-..       - .... .. ...       -- --- .-. ... .       -.-. --- -.. .       --. . -. . .-. .- - --- .-.       ..- ... . ...       - .... .       .. -. - . .-. -. .- - .. --- -. .- .-..       ... - -.-- .-.. .       -- --- .-. ... .       -.-. --- -.. . .-.-.-             - .... .       .-.-.-       .- -. -..              -- .- -.- .       ..- .--.       .- .-.. .-..       - .... .       -.-. --- -.. . --..--       - .... . .-. .       .. ...       --- -. .       ... .--. .- -.-. .       - .... .- -       ... . .--. .- .-. .- - . ...       .-.. . - - . .-. ...       .- -. -..       .....       ... .--. .- -.-. . ...       - .... .- -       ... . .--. .- .-. .- - .       .-- --- .-. -.. ... .-.-.-             ... --- -- .       .--. ..- -. -.-. - ..- .- - .. --- -.       .. ...       ..- ... . -.. .-.-.- .-.-.- .-.-.-             --- - .... . .-.       - .... . -.       - .... .- - --..--       .- .-.. .-..       -.-- --- ..-       -. . . -..       - ---       -.. ---       .. ...       - .- -.- .       .. -.       ... --- -- .       - -.-- .--. .       --- ..-.       - . -..- -       .. -.       - .... .       ..-. --- .-. --       --- ..-.       .-       ... - .-. .. -. --.       .- -. -..       - ..- .-. -.       .. -       .. -. - ---       .-       -- --- .-. ... .       -.-. --- -.. .       .-.. .. -. .        -.-. .... .- .-.       -.-. .-.. .- ... ...  --..--       .- ...       - .... .       . -..- .- -- .--. .-.. .       -... . .-.. --- .--       ... .... --- .-- ...  \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003etext = 'Morse code is FUN!'\r\nMorse_code_out = '-- --- .-. ... .       -.-. --- -.. .       .. ...       ..-. ..- -. -.-.--'\r\n\u003c/pre\u003e\u003cp\u003eJust a note: this uses international style Morse code found in:\u003c/p\u003e\u003cp\u003e\u003ca href = \"http://en.wikipedia.org/wiki/American_Morse_code\"\u003ehttp://en.wikipedia.org/wiki/American_Morse_code\u003c/a\u003e\u003c/p\u003e","function_template":"function Morse_code_out = MorseCodeGenerator(text)\r\n  Morse_code_out = text_in;\r\nend","test_suite":"%%\r\nx = 'Morse code is FUN!';\r\ny_correct = '-- --- .-. ... .     -.-. --- -.. .     .. ...     ..-. ..- -. -.-.--';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n%%\r\nx = 'Am I 20, (who knows?)';\r\ny_correct = '.- --     ..     ..--- ----- --..--     -.--. .-- .... ---     -.- -. --- .-- ... ..--.. -.--.-';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n%%\r\nx = 'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: or does he...';\r\ny_correct = '- .... .     --.- ..- .. -.-. -.-     -... .-. --- .-- -.     ..-. --- -..-     .--- ..- -- .--. ...     --- ...- . .-.     - .... .     .-.. .- --.. -.--     -.. --- --. ---...     --- .-.     -.. --- . ...     .... . .-.-.- .-.-.- .-.-.-';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n%%\r\nx = '1234567890';\r\ny_correct = '.---- ..--- ...-- ....- ..... -.... --... ---.. ----. -----';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":92,"test_suite_updated_at":"2019-09-16T11:37:52.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-07-05T18:50:09.000Z","updated_at":"2025-12-29T01:11:58.000Z","published_at":"2013-07-09T15:55:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[.... . .-.. .-.. ---     . ...- . .-. -.-- --- -. . -.-.-- \\n      .-.. . - ...       -.. ---       ... --- -- .       -- --- .-. ... .       -.-. --- -.. . -.-.--             .-- . .-.. .-..       - .... .. ...       -- --- .-. ... .       -.-. --- -.. .       --. . -. . .-. .- - --- .-.       ..- ... . ...       - .... .       .. -. - . .-. -. .- - .. --- -. .- .-..       ... - -.-- .-.. .       -- --- .-. ... .       -.-. --- -.. . .-.-.-             - .... .       .-.-.-       .- -. -..              -- .- -.- .       ..- .--.       .- .-.. .-..       - .... .       -.-. --- -.. . --..--       - .... . .-. .       .. ...       --- -. .       ... .--. .- -.-. .       - .... .- -       ... . .--. .- .-. .- - . ...       .-.. . - - . .-. ...       .- -. -..       .....       ... .--. .- -.-. . ...       - .... .- -       ... . .--. .- .-. .- - .       .-- --- .-. -.. ... .-.-.-             ... --- -- .       .--. ..- -. -.-. - ..- .- - .. --- -.       .. ...       ..- ... . -.. .-.-.- .-.-.- .-.-.-             --- - .... . .-.       - .... . -.       - .... .- - --..--       .- .-.. .-..       -.-- --- ..-       -. . . -..       - ---       -.. ---       .. ...       - .- -.- .       .. -.       ... --- -- .       - -.-- .--. .       --- ..-.       - . -..- -       .. -.       - .... .       ..-. --- .-. --       --- ..-.       .-       ... - .-. .. -. --.       .- -. -..       - ..- .-. -.       .. -       .. -. - ---       .-       -- --- .-. ... .       -.-. --- -.. .       .-.. .. -. .        -.-. .... .- .-.       -.-. .-.. .- ... ...  --..--       .- ...       - .... .       . -..- .- -- .--. .-.. .       -... . .-.. --- .--       ... .... --- .-- ...  \\n\\ntext = 'Morse code is FUN!'\\nMorse_code_out = '-- --- .-. ... .       -.-. --- -.. .       .. ...       ..-. ..- -. -.-.--']]\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\u003eJust a note: this uses international style Morse code found in:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/American_Morse_code\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/American_Morse_code\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1201,"title":"Simple Decoder Ring","description":"The stereotypical decoder ring is remembered as a cereal box prize from the 1950s. Kids learned about cryptography by starting with the simple transposition cipher. There were many different rings made. One of the more common had two rings on a common center, each with the letters of the alphabet in order. You would rotate the inner ring relative to the outer to produce a shift of letters, so the cipher was to produce a positive or negative shift of the alphabet, giving a letter by letter code key.\r\nWhether or not it really was in cereal boxes, your job is to produce a MATLAB function that codes a string using the letter shift required. You must keep the case of the output the same as the input.\r\n simpleDecoderRing('I am ready to try it - with punctuation and CAPS!',-3)\r\nis\r\n 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!'","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 222px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 468.5px 111px; transform-origin: 468.5px 111px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 444.5px 42px; text-align: left; transform-origin: 444.5px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 53.2917px 8px; transform-origin: 53.2917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe stereotypical\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: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \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: 38.9083px 8px; transform-origin: 38.9083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003edecoder ring\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: 330.625px 8px; transform-origin: 330.625px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is remembered as a cereal box prize from the 1950s. Kids learned about cryptography by starting with the simple transposition cipher. There were many different rings made. One of the more common had two rings on a common center, each with the letters of the alphabet in order. You would rotate the inner ring relative to the outer to produce a shift of letters, so the cipher was to produce a positive or negative shift of the alphabet, giving a letter by letter code key.\u003c/span\u003e\u003c/span\u003e\u003c/div\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 444.5px 21px; text-align: left; transform-origin: 444.5px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 433.3px 8px; transform-origin: 433.3px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhether or not it really was in cereal boxes, your job is to produce a MATLAB function that codes a string using the letter shift required. You must keep the case of the output the same as the input.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 18px; 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 464.5px 9px; transform-origin: 464.5px 9px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; line-height: 18px; 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; padding-inline-start: 4px; padding-left: 4px; text-wrap-mode: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(33, 33, 33); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(33, 33, 33); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(33, 33, 33); border-left-style: none; border-left-width: 0px; border-right-color: rgb(33, 33, 33); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 284.9px 8.5px; tab-size: 4; transform-origin: 284.9px 8.5px; unicode-bidi: normal; white-space-collapse: preserve; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 73.15px 8.5px; transform-origin: 73.15px 8.5px; \"\u003e simpleDecoderRing(\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(133, 22, 209); border-block-start-color: rgb(133, 22, 209); border-bottom-color: rgb(133, 22, 209); border-inline-end-color: rgb(133, 22, 209); border-inline-start-color: rgb(133, 22, 209); border-left-color: rgb(133, 22, 209); border-right-color: rgb(133, 22, 209); border-top-color: rgb(133, 22, 209); caret-color: rgb(133, 22, 209); color: rgb(133, 22, 209); column-rule-color: rgb(133, 22, 209); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(133, 22, 209); perspective-origin: 196.35px 8.5px; text-decoration-color: rgb(133, 22, 209); text-emphasis-color: rgb(133, 22, 209); transform-origin: 196.35px 8.5px; \"\u003e'I am ready to try it - with punctuation and CAPS!'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 15.4px 8.5px; transform-origin: 15.4px 8.5px; \"\u003e,-3)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 444.5px 10.5px; text-align: left; transform-origin: 444.5px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 5.05833px 8px; transform-origin: 5.05833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eis\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 18px; 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 464.5px 9px; transform-origin: 464.5px 9px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; line-height: 18px; 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; padding-inline-start: 4px; padding-left: 4px; text-wrap-mode: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(33, 33, 33); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(33, 33, 33); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(33, 33, 33); border-left-style: none; border-left-width: 0px; border-right-color: rgb(33, 33, 33); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 200.2px 8.5px; tab-size: 4; transform-origin: 200.2px 8.5px; unicode-bidi: normal; white-space-collapse: preserve; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.5px; transform-origin: 3.85px 8.5px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(133, 22, 209); border-block-start-color: rgb(133, 22, 209); border-bottom-color: rgb(133, 22, 209); border-inline-end-color: rgb(133, 22, 209); border-inline-start-color: rgb(133, 22, 209); border-left-color: rgb(133, 22, 209); border-right-color: rgb(133, 22, 209); border-top-color: rgb(133, 22, 209); caret-color: rgb(133, 22, 209); color: rgb(133, 22, 209); column-rule-color: rgb(133, 22, 209); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(133, 22, 209); perspective-origin: 196.35px 8.5px; text-decoration-color: rgb(133, 22, 209); text-emphasis-color: rgb(133, 22, 209); transform-origin: 196.35px 8.5px; \"\u003e'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [ outString ] = simpleDecoderRing( inString, inShift )\r\n  outString = inString;\r\nend","test_suite":"%%\r\nfiletext = fileread('simpleDecoderRing.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'eval');\r\nassert(~illegal)\r\n\r\n%%\r\ninString1 = 'I am ready to try it - with punctuation and CAPS!';\r\noutString1a = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!';\r\nassert(isequal(simpleDecoderRing(inString1,-3),outString1a ));\r\n\r\n%%\r\ninString1 = 'I am ready to try it - with punctuation and CAPS!';\r\noutString1b = 'L dp uhdgb wr wub lw - zlwk sxqfwxdwlrq dqg FDSV!';\r\nassert(isequal(simpleDecoderRing(inString1,3),outString1b ));\r\n\r\n%%\r\ninString2 = 'Dick Tracy is often associated with decoder rings.';\r\noutString2a = 'Lqks Bzikg qa wnbmv iaawkqibml eqbp lmkwlmz zqvoa.';\r\nassert(isequal(simpleDecoderRing(inString2,-18),outString2a ));\r\n\r\n%%\r\ninString2 = 'Dick Tracy is often associated with decoder rings.';\r\noutString2b = 'Zeyg Pnwyu eo kbpaj wookyewpaz sepd zaykzan nejco.';\r\nassert(isequal(simpleDecoderRing(inString2,22),outString2b ));\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":2193,"edited_by":223089,"edited_at":"2026-03-04T11:09:29.000Z","deleted_by":null,"deleted_at":null,"solvers_count":116,"test_suite_updated_at":"2026-03-04T11:09:29.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-01-13T01:59:05.000Z","updated_at":"2026-03-04T11:11:10.000Z","published_at":"2013-01-13T02:00:51.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe stereotypical\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edecoder ring\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is remembered as a cereal box prize from the 1950s. Kids learned about cryptography by starting with the simple transposition cipher. There were many different rings made. One of the more common had two rings on a common center, each with the letters of the alphabet in order. You would rotate the inner ring relative to the outer to produce a shift of letters, so the cipher was to produce a positive or negative shift of the alphabet, giving a letter by letter code key.\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\u003eWhether or not it really was in cereal boxes, your job is to produce a MATLAB function that codes a string using the letter shift required. You must keep the case of the output the same as the input.\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[ simpleDecoderRing('I am ready to try it - with punctuation and CAPS!',-3)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eis\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[ 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!']]\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":1201,"title":"Simple Decoder Ring","description":"The stereotypical decoder ring is remembered as a cereal box prize from the 1950s. Kids learned about cryptography by starting with the simple transposition cipher. There were many different rings made. One of the more common had two rings on a common center, each with the letters of the alphabet in order. You would rotate the inner ring relative to the outer to produce a shift of letters, so the cipher was to produce a positive or negative shift of the alphabet, giving a letter by letter code key.\r\nWhether or not it really was in cereal boxes, your job is to produce a MATLAB function that codes a string using the letter shift required. You must keep the case of the output the same as the input.\r\n simpleDecoderRing('I am ready to try it - with punctuation and CAPS!',-3)\r\nis\r\n 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!'","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 222px; display: block; min-width: 0px; padding-block-start: 0px; padding-inline-start: 2px; padding-left: 2px; padding-top: 0px; perspective-origin: 468.5px 111px; transform-origin: 468.5px 111px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 444.5px 42px; text-align: left; transform-origin: 444.5px 42px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 53.2917px 8px; transform-origin: 53.2917px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe stereotypical\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: 1.94167px 8px; transform-origin: 1.94167px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \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: 38.9083px 8px; transform-origin: 38.9083px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003edecoder ring\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: 330.625px 8px; transform-origin: 330.625px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is remembered as a cereal box prize from the 1950s. Kids learned about cryptography by starting with the simple transposition cipher. There were many different rings made. One of the more common had two rings on a common center, each with the letters of the alphabet in order. You would rotate the inner ring relative to the outer to produce a shift of letters, so the cipher was to produce a positive or negative shift of the alphabet, giving a letter by letter code key.\u003c/span\u003e\u003c/span\u003e\u003c/div\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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 444.5px 21px; text-align: left; transform-origin: 444.5px 21px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 433.3px 8px; transform-origin: 433.3px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhether or not it really was in cereal boxes, your job is to produce a MATLAB function that codes a string using the letter shift required. You must keep the case of the output the same as the input.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 18px; 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 464.5px 9px; transform-origin: 464.5px 9px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; line-height: 18px; 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; padding-inline-start: 4px; padding-left: 4px; text-wrap-mode: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(33, 33, 33); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(33, 33, 33); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(33, 33, 33); border-left-style: none; border-left-width: 0px; border-right-color: rgb(33, 33, 33); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 284.9px 8.5px; tab-size: 4; transform-origin: 284.9px 8.5px; unicode-bidi: normal; white-space-collapse: preserve; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 73.15px 8.5px; transform-origin: 73.15px 8.5px; \"\u003e simpleDecoderRing(\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(133, 22, 209); border-block-start-color: rgb(133, 22, 209); border-bottom-color: rgb(133, 22, 209); border-inline-end-color: rgb(133, 22, 209); border-inline-start-color: rgb(133, 22, 209); border-left-color: rgb(133, 22, 209); border-right-color: rgb(133, 22, 209); border-top-color: rgb(133, 22, 209); caret-color: rgb(133, 22, 209); color: rgb(133, 22, 209); column-rule-color: rgb(133, 22, 209); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(133, 22, 209); perspective-origin: 196.35px 8.5px; text-decoration-color: rgb(133, 22, 209); text-emphasis-color: rgb(133, 22, 209); transform-origin: 196.35px 8.5px; \"\u003e'I am ready to try it - with punctuation and CAPS!'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 15.4px 8.5px; transform-origin: 15.4px 8.5px; \"\u003e,-3)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 444.5px 10.5px; text-align: left; transform-origin: 444.5px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 5.05833px 8px; transform-origin: 5.05833px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eis\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 18px; 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; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 464.5px 9px; transform-origin: 464.5px 9px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); 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; font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; line-height: 18px; 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; padding-inline-start: 4px; padding-left: 4px; text-wrap-mode: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(33, 33, 33); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(33, 33, 33); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(33, 33, 33); border-left-style: none; border-left-width: 0px; border-right-color: rgb(33, 33, 33); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 200.2px 8.5px; tab-size: 4; transform-origin: 200.2px 8.5px; unicode-bidi: normal; white-space-collapse: preserve; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 3.85px 8.5px; transform-origin: 3.85px 8.5px; \"\u003e \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(133, 22, 209); border-block-start-color: rgb(133, 22, 209); border-bottom-color: rgb(133, 22, 209); border-inline-end-color: rgb(133, 22, 209); border-inline-start-color: rgb(133, 22, 209); border-left-color: rgb(133, 22, 209); border-right-color: rgb(133, 22, 209); border-top-color: rgb(133, 22, 209); caret-color: rgb(133, 22, 209); color: rgb(133, 22, 209); column-rule-color: rgb(133, 22, 209); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(133, 22, 209); perspective-origin: 196.35px 8.5px; text-decoration-color: rgb(133, 22, 209); text-emphasis-color: rgb(133, 22, 209); transform-origin: 196.35px 8.5px; \"\u003e'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [ outString ] = simpleDecoderRing( inString, inShift )\r\n  outString = inString;\r\nend","test_suite":"%%\r\nfiletext = fileread('simpleDecoderRing.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'eval');\r\nassert(~illegal)\r\n\r\n%%\r\ninString1 = 'I am ready to try it - with punctuation and CAPS!';\r\noutString1a = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!';\r\nassert(isequal(simpleDecoderRing(inString1,-3),outString1a ));\r\n\r\n%%\r\ninString1 = 'I am ready to try it - with punctuation and CAPS!';\r\noutString1b = 'L dp uhdgb wr wub lw - zlwk sxqfwxdwlrq dqg FDSV!';\r\nassert(isequal(simpleDecoderRing(inString1,3),outString1b ));\r\n\r\n%%\r\ninString2 = 'Dick Tracy is often associated with decoder rings.';\r\noutString2a = 'Lqks Bzikg qa wnbmv iaawkqibml eqbp lmkwlmz zqvoa.';\r\nassert(isequal(simpleDecoderRing(inString2,-18),outString2a ));\r\n\r\n%%\r\ninString2 = 'Dick Tracy is often associated with decoder rings.';\r\noutString2b = 'Zeyg Pnwyu eo kbpaj wookyewpaz sepd zaykzan nejco.';\r\nassert(isequal(simpleDecoderRing(inString2,22),outString2b ));\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":2193,"edited_by":223089,"edited_at":"2026-03-04T11:09:29.000Z","deleted_by":null,"deleted_at":null,"solvers_count":116,"test_suite_updated_at":"2026-03-04T11:09:29.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-01-13T01:59:05.000Z","updated_at":"2026-03-04T11:11:10.000Z","published_at":"2013-01-13T02:00:51.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe stereotypical\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edecoder ring\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is remembered as a cereal box prize from the 1950s. Kids learned about cryptography by starting with the simple transposition cipher. There were many different rings made. One of the more common had two rings on a common center, each with the letters of the alphabet in order. You would rotate the inner ring relative to the outer to produce a shift of letters, so the cipher was to produce a positive or negative shift of the alphabet, giving a letter by letter code key.\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\u003eWhether or not it really was in cereal boxes, your job is to produce a MATLAB function that codes a string using the letter shift required. You must keep the case of the output the same as the input.\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[ simpleDecoderRing('I am ready to try it - with punctuation and CAPS!',-3)]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eis\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[ 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!']]\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":1218,"title":"Join Strings with Multiple Different Delimiters","description":"The idea is to form the string  S by interleaving the elements of a cell array of strings DELIMITER and another cell array of strings C.\r\n\r\nExample of 2 inputs:\r\n \r\n  C = {'I','MATLAB'};\r\n  DELIMITER  = {' love '})\r\n\r\nExpected Output:\r\n\r\n  S = 'I love MATLAB'","description_html":"\u003cp\u003eThe idea is to form the string  S by interleaving the elements of a cell array of strings DELIMITER and another cell array of strings C.\u003c/p\u003e\u003cp\u003eExample of 2 inputs:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eC = {'I','MATLAB'};\r\nDELIMITER  = {' love '})\r\n\u003c/pre\u003e\u003cp\u003eExpected Output:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eS = 'I love MATLAB'\r\n\u003c/pre\u003e","function_template":"function S = your_fcn_name(C,DELIMITER)\r\n  S = '';\r\nend","test_suite":"%%\r\n  C = {'I','MATLAB'};\r\n  DELIMITER  = {' love '}\r\nS= 'I love MATLAB'\r\nassert(isequal(your_fcn_name(C,DELIMITER),S))\r\n\r\n%%\r\n  c = {'one', 'two', 'three'};\r\n  DELIM  = {' + ', ' = '}\r\nS2= 'one + two = three'\r\nassert(isequal(your_fcn_name(c,DELIM),S2))\r\n\r\n%%\r\n  c = {'First sentence', 'Second sentence', 'Third sentence.'};\r\n  DELIM  = {'. ', '. '}\r\nS2= 'First sentence. Second sentence. Third sentence.'\r\nassert(isequal(your_fcn_name(c,DELIM),S2))\r\n\r\n%%\r\n  c = {'Have you ', 'ever had ', 'someone continuously ', 'interrupting you?'};\r\n  DELIM  = {'(HEY!) ', '(BOO!) ', '(LOOK OVER THERE!) '}\r\nS2= 'Have you (HEY!) ever had (BOO!) someone continuously (LOOK OVER THERE!) interrupting you?'\r\nassert(isequal(your_fcn_name(c,DELIM),S2))\r\n\r\n%%\r\n  c = {'My first ', 'name ', 'is ', 'Tom.'};\r\n  DELIM  = {'child has a ', 'that ', 'not '}\r\nS2= 'My first child has a name that is not Tom.'\r\nassert(isequal(your_fcn_name(c,DELIM),S2))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":639,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":224,"test_suite_updated_at":"2017-05-31T17:01:22.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-01-22T15:13:49.000Z","updated_at":"2026-03-06T20:33:31.000Z","published_at":"2013-01-22T15:13: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\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe idea is to form the string S by interleaving the elements of a cell array of strings DELIMITER and another cell array of strings C.\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 of 2 inputs:\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[C = {'I','MATLAB'};\\nDELIMITER  = {' love '})]]\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\u003eExpected Output:\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[S = 'I love MATLAB']]\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":1303,"title":"Is the paranthesis sequence balanced ?","description":"Quantum mechanics and computer science are interested in bra-kets. Today however you, the player, will have to write a function to find if the given parenthesis expression is balanced.\r\ne.g.\r\n\u003e\u003e balance('(()()())')\r\n   1\r\n\r\n\u003e\u003e balance('(()()())(') \r\n   0\r\n\r\n\u003e\u003e balance('(())))()())')\r\n   0\r\n\r\n\u003e\u003e balance('(((()))((())))')\r\n   1\r\nHint: consider using a stack. Review your basic data structures for ideas.","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: 337.767px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 168.883px; transform-origin: 407px 168.883px; 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: 189.5px 8px; transform-origin: 189.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eQuantum mechanics and computer science are interested in\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ebra-kets\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 163px 8px; transform-origin: 163px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Today however you, the player, will have to write a function to find if the given parenthesis expression is balanced.\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: 12px 8px; transform-origin: 12px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ee.g.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 224.767px; 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 112.383px; transform-origin: 404px 112.383px; 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: 88px 8.5px; tab-size: 4; transform-origin: 88px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 40px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 40px 8.5px; \"\u003e'(()()())'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   1\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: 96px 8.5px; tab-size: 4; transform-origin: 96px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 44px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 44px 8.5px; \"\u003e'(()()())('\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 8px 8.5px; transform-origin: 8px 8.5px; \"\u003e) \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   0\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: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 52px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 52px 8.5px; \"\u003e'(())))()())'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   0\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: 112px 8.5px; tab-size: 4; transform-origin: 112px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 44px 8.5px; transform-origin: 44px 8.5px; \"\u003e\u0026gt;\u0026gt; balance(\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: 64px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 64px 8.5px; \"\u003e'(((()))((())))'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 16px 8.5px; tab-size: 4; transform-origin: 16px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e   1\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 129px 8px; transform-origin: 129px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eHint: consider using a stack. Review your\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ebasic data structures\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 31.5px 8px; transform-origin: 31.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e for ideas.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = balance_parens(x)\r\n  stack = [];\r\n  y = x;\r\nend\r\n","test_suite":"%%\r\nassert(isequal(balance_parens('(((()))((())))'),1))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()())'),1))\r\n\r\n%%\r\nassert(isequal(balance_parens(['(()()()()()()()()()()()())']),1))\r\n\r\n%%\r\nassert(isequal(balance_parens(')('),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()()))))'),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()(((((((((((()))))'),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('))()())'),0))\r\n\r\n%%\r\nassert(isequal(balance_parens('(()()()()((()))()()()(((()))))'),1))\r\n\r\n%%\r\nassert(isequal(balance_parens('((((()))))'),1))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":11,"created_by":3378,"edited_by":223089,"edited_at":"2022-10-19T14:45:58.000Z","deleted_by":null,"deleted_at":null,"solvers_count":200,"test_suite_updated_at":"2022-10-19T14:45:58.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-02-27T01:52:24.000Z","updated_at":"2026-04-02T18:55:37.000Z","published_at":"2013-02-27T02:03:15.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eQuantum mechanics and computer science are interested in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ebra-kets\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Today however you, the player, will have to write a function to find if the given parenthesis expression is balanced.\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.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[\u003e\u003e balance('(()()())')\\n   1\\n\\n\u003e\u003e balance('(()()())(') \\n   0\\n\\n\u003e\u003e balance('(())))()())')\\n   0\\n\\n\u003e\u003e balance('(((()))((())))')\\n   1]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: consider using a stack. Review your\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ebasic data structures\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e for ideas.\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":1383,"title":"Count letters occurence in text, specific to words with a given length.","description":"Build a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\r\n\r\n* Case insensitive.\r\n* Words contain only letters a-zA-Z, but the string can contain punctuation.\r\n\r\n*Example*\r\n\r\n \u003e\u003e txt = 'Hello World, from MATLAB' ;\r\n \u003e\u003e nl  = 5 ;                              % Number of letters.\r\n \u003e\u003e nlWords_getCounts(txt, nl)\r\n ans = \r\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0\r\n\r\nhere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\r\n ","description_html":"\u003cp\u003eBuild a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\u003c/p\u003e\u003cul\u003e\u003cli\u003eCase insensitive.\u003c/li\u003e\u003cli\u003eWords contain only letters a-zA-Z, but the string can contain punctuation.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e \u003e\u003e txt = 'Hello World, from MATLAB' ;\r\n \u003e\u003e nl  = 5 ;                              % Number of letters.\r\n \u003e\u003e nlWords_getCounts(txt, nl)\r\n ans = \r\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0\u003c/pre\u003e\u003cp\u003ehere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\u003c/p\u003e","function_template":"function counts = nlWords_getCounts(txt, nl)\r\n  counts = 0 ;\r\nend","test_suite":"%%\r\ntxt = 'Hello World, from MATLAB' ;\r\nnl  = 5 ;\r\ncounts_correct = [0 0 0 1 1 0 0 1 0 0 0 3 0 0 2 0 0 1 0 0 0 0 1 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n\r\n%%\r\ntxt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'\r\nnl  = 9 ;\r\ncounts_correct = [3 0 3 1 5 0 1 1 0 0 0 1 0 2 1 2 0 2 2 0 2 0 1 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n\r\n%%\r\ntxt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'\r\nnl  = 10 ;\r\ncounts_correct = [6 0 6 0 3 0 0 3 0 0 0 0 0 0 0 0 0 6 3 3 0 0 0 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":9862,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":197,"test_suite_updated_at":"2013-03-25T03:27:53.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-03-25T03:08:33.000Z","updated_at":"2026-03-10T20:25:05.000Z","published_at":"2013-03-25T03:27:53.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\u003eBuild a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCase insensitive.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWords contain only letters a-zA-Z, but the string can contain punctuation.\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[ \u003e\u003e txt = 'Hello World, from MATLAB' ;\\n \u003e\u003e nl  = 5 ;                              % Number of letters.\\n \u003e\u003e nlWords_getCounts(txt, nl)\\n ans = \\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0]]\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\u003ehere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\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":1466,"title":"Convert Two Character String into a Binary Vector","description":"Given a string \"XOXXO\" convert it into a binary vector. [1 0 1 1 0]\r\n\r\nPaul Berglund implemented an optimal method in \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1440-usc-spring-2013-acm-snow-cones/solutions/map Snow Cones\u003e\r\n\r\n*Input:* \"XXOOX\"\r\n\r\n*Output:* [1 1 0 0 1]\r\n\r\n","description_html":"\u003cp\u003eGiven a string \"XOXXO\" convert it into a binary vector. [1 0 1 1 0]\u003c/p\u003e\u003cp\u003ePaul Berglund implemented an optimal method in \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1440-usc-spring-2013-acm-snow-cones/solutions/map\"\u003eSnow Cones\u003c/a\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e \"XXOOX\"\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e [1 1 0 0 1]\u003c/p\u003e","function_template":"function binvec=str2Binvec(str)\r\n  binvec=[];\r\nend","test_suite":"%%\r\n expect_bin=randi(2,1,10)-1;\r\n str=char(9*expect_bin+79);\r\n binvec=str2Binvec(str);\r\n assert(isequal(expect_bin,binvec))\r\n%%\r\n expect_bin=randi(2,1,5)-1;\r\n str=char(9*expect_bin+79);\r\n binvec=str2Binvec(str);\r\n assert(isequal(expect_bin,binvec))\r\n%%\r\n expect_bin=randi(2,1,25)-1;\r\n str=char(9*expect_bin+79);\r\n binvec=str2Binvec(str);\r\n assert(isequal(expect_bin,binvec))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":233,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-04-27T16:28:47.000Z","updated_at":"2026-02-22T01:50:39.000Z","published_at":"2013-04-27T16:40: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\",\"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 string \\\"XOXXO\\\" convert it into a binary vector. [1 0 1 1 0]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePaul Berglund implemented an optimal method in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1440-usc-spring-2013-acm-snow-cones/solutions/map\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSnow Cones\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \\\"XXOOX\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [1 1 0 0 1]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1499,"title":"Kryptos - CIA Cypher Sculpture: Vigenere Encryption","description":"The \u003chttp://en.wikipedia.org/wiki/Kryptos Kryptos Sculpture\u003e contains four encypted messages.\r\n\r\nThis Challenge is to Encrypt two of the original messages for the sculptor.\r\n\r\nThe method employed is \u003chttp://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher Vigenere Encryption\u003e. One clarification is that \"?\" are removed from the coding sequence and then re-inserted in the final encoded message.\r\n\r\nOriginal phrase: Between subtle shading and the absence of light lies the nuance of iqlusion.\r\n\r\nFor coding purposes spaces and punctuation are removed, except \"?\".\r\n\r\nPhrase to encode: BETWEENSUBTLESHADINGANDTHEABSENCEOFLIGHTLIESTHENUANCEOFIQLUSION\r\n\r\n*Input:* Encode Phrase, Vigenere alphabet word, Vigenere shift word\r\n\r\nVigenere alphabet word ='KRYPTOS';\r\n\r\nVigenere shift word ='PALIMPSEST';\r\n\r\n*Output:* EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD\r\n\r\nThe encryption matrix for this case:\r\n\r\n  KRYPTOSABCDEFGHIJLMNQUVWXZ\r\n\r\n  PTOSABCDEFGHIJLMNQUVWXZKRY\r\n  ABCDEFGHIJLMNQUVWXZKRYPTOS\r\n  LMNQUVWXZKRYPTOSABCDEFGHIJ\r\n  IJLMNQUVWXZKRYPTOSABCDEFGH\r\n  MNQUVWXZKRYPTOSABCDEFGHIJL\r\n  PTOSABCDEFGHIJLMNQUVWXZKRY\r\n  SABCDEFGHIJLMNQUVWXZKRYPTO\r\n  EFGHIJLMNQUVWXZKRYPTOSABCD\r\n  SABCDEFGHIJLMNQUVWXZKRYPTO\r\n  TOSABCDEFGHIJLMNQUVWXZKRYP\r\n\r\nFollow Up Challenges:\r\n\r\n1) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1500-kryptos-cia-cypher-sculpture-vignere-decryption Vigenere Decryption\u003e\r\n\r\n2) Dictionary search\r\n\r\n3) KRYPTOS Part IV\r\n\r\n\u003chttp://math.ucsd.edu/~crypto/Projects/KarlWang/index2.html#1 KRYPTOS Solutions\u003e\r\n\r\n  \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","description_html":"\u003cp\u003eThe \u003ca href = \"http://en.wikipedia.org/wiki/Kryptos\"\u003eKryptos Sculpture\u003c/a\u003e contains four encypted messages.\u003c/p\u003e\u003cp\u003eThis Challenge is to Encrypt two of the original messages for the sculptor.\u003c/p\u003e\u003cp\u003eThe method employed is \u003ca href = \"http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher\"\u003eVigenere Encryption\u003c/a\u003e. One clarification is that \"?\" are removed from the coding sequence and then re-inserted in the final encoded message.\u003c/p\u003e\u003cp\u003eOriginal phrase: Between subtle shading and the absence of light lies the nuance of iqlusion.\u003c/p\u003e\u003cp\u003eFor coding purposes spaces and punctuation are removed, except \"?\".\u003c/p\u003e\u003cp\u003ePhrase to encode: BETWEENSUBTLESHADINGANDTHEABSENCEOFLIGHTLIESTHENUANCEOFIQLUSION\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e Encode Phrase, Vigenere alphabet word, Vigenere shift word\u003c/p\u003e\u003cp\u003eVigenere alphabet word ='KRYPTOS';\u003c/p\u003e\u003cp\u003eVigenere shift word ='PALIMPSEST';\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD\u003c/p\u003e\u003cp\u003eThe encryption matrix for this case:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eKRYPTOSABCDEFGHIJLMNQUVWXZ\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ePTOSABCDEFGHIJLMNQUVWXZKRY\r\nABCDEFGHIJLMNQUVWXZKRYPTOS\r\nLMNQUVWXZKRYPTOSABCDEFGHIJ\r\nIJLMNQUVWXZKRYPTOSABCDEFGH\r\nMNQUVWXZKRYPTOSABCDEFGHIJL\r\nPTOSABCDEFGHIJLMNQUVWXZKRY\r\nSABCDEFGHIJLMNQUVWXZKRYPTO\r\nEFGHIJLMNQUVWXZKRYPTOSABCD\r\nSABCDEFGHIJLMNQUVWXZKRYPTO\r\nTOSABCDEFGHIJLMNQUVWXZKRYP\r\n\u003c/pre\u003e\u003cp\u003eFollow Up Challenges:\u003c/p\u003e\u003cp\u003e1) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1500-kryptos-cia-cypher-sculpture-vignere-decryption\"\u003eVigenere Decryption\u003c/a\u003e\u003c/p\u003e\u003cp\u003e2) Dictionary search\u003c/p\u003e\u003cp\u003e3) KRYPTOS Part IV\u003c/p\u003e\u003cp\u003e\u003ca href = \"http://math.ucsd.edu/~crypto/Projects/KarlWang/index2.html#1\"\u003eKRYPTOS Solutions\u003c/a\u003e\u003c/p\u003e","function_template":"function encoded=encode_vigenere(phrase,word1,word2)\r\n encoded=phrase;\r\nend","test_suite":"phrase=upper('Between subtle shading and the absence of light lies the nuance of iqlusion.');\r\nphrase_encode=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\nencoded_exp='EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD';\r\nword1='KRYPTOS';\r\nword2='PALIMPSEST';\r\nencoded= encode_vigenere(phrase_encode,word1,word2);\r\n\r\nassert(strcmp(encoded_exp,encoded))\r\n%%\r\n\r\nphrase=upper('It was totally invisible Hows that possible? They used the Earths magnetic field X The information was gathered and transmitted undergruund to an unknown location X Does Langley know about this? They should Its buried out there somewhere X Who knows the exact location? Only WW This was his last message X Thirty eight degrees fifty seven minutes six point five seconds north Seventy seven degrees eight minutes forty four seconds west ID by rows');\r\nphrase_encode=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\n\r\nencoded_exp='VFPJUDEEHZWETZYVGWHKKQETGFQJNCEGGWHKK?DQMCPFQZDQMMIAGPFXHQRLGTIMVMZJANQLVKQEDAGDVFRPJUNGEUNAQZGZLECGYUXUEENJTBJLBQCRTBJDFHRRYIZETKZEMVDUFKSJHKFWHKUWQLSZFTIHHDDDUVH?DWKBFUFPWNTDFIYCUQZEREEVLDKFEZMOQQJLTTUGSYQPFEUNLAVIDXFLGGTEZ?FKZBSFDQVGOGIPUFXHHDRKFFHQNTGPUAECNUVPDJMQCLQUMUNEDFQELZZVRRGKFFVOEEXBDMVPNFQXEZLGREDNQFMPNZGLFLPMRJQYALMGNUVPDXVKPDQUMEBEDMHDAFMJGZNUPLGEWJLLAETG';\r\n\r\nword1='KRYPTOS';\r\nword2='ABSCISSA';\r\nencoded= encode_vigenere(phrase_encode,word1,word2);\r\n\r\nassert(strcmp(encoded_exp,encoded))\r\n%%\r\nphrase=upper('The fox jumped over the moon');\r\nphrase_encode=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\nencoded_exp='VUIPFSBYVQMMWPIMEVPZCVK';\r\nword1='KRYPTOS';\r\nword2='MATLAB';\r\nencoded= encode_vigenere(phrase_encode,word1,word2);\r\n\r\nassert(strcmp(encoded_exp,encoded))\r\n\r\n%%\r\nphrase=upper('Between the Devil and the deep blue sea');\r\nphrase_encode=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\n\r\nword1='AWEIGH';\r\nword2='MATLAB';\r\nencoded= encode_vigenere(phrase_encode,word1,word2);\r\nencoded_exp='SENMEDWTZNDDFIBLNNCHVTEDIBBCEZOA';\r\n\r\nassert(strcmp(encoded_exp,encoded))\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":3,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":61,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-05-11T20:36:34.000Z","updated_at":"2026-03-07T04:46:20.000Z","published_at":"2013-05-11T21:19:07.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe\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://en.wikipedia.org/wiki/Kryptos\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKryptos Sculpture\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e contains four encypted messages.\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 Challenge is to Encrypt two of the original messages for the sculptor.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe method employed is\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://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eVigenere Encryption\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. One clarification is that \\\"?\\\" are removed from the coding sequence and then re-inserted in the final encoded message.\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\u003eOriginal phrase: Between subtle shading and the absence of light lies the nuance of iqlusion.\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 coding purposes spaces and punctuation are removed, except \\\"?\\\".\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\u003ePhrase to encode: BETWEENSUBTLESHADINGANDTHEABSENCEOFLIGHTLIESTHENUANCEOFIQLUSION\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Encode Phrase, Vigenere alphabet word, Vigenere shift word\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\u003eVigenere alphabet word ='KRYPTOS';\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\u003eVigenere shift word ='PALIMPSEST';\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe encryption matrix for this case:\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[KRYPTOSABCDEFGHIJLMNQUVWXZ\\n\\nPTOSABCDEFGHIJLMNQUVWXZKRY\\nABCDEFGHIJLMNQUVWXZKRYPTOS\\nLMNQUVWXZKRYPTOSABCDEFGHIJ\\nIJLMNQUVWXZKRYPTOSABCDEFGH\\nMNQUVWXZKRYPTOSABCDEFGHIJL\\nPTOSABCDEFGHIJLMNQUVWXZKRY\\nSABCDEFGHIJLMNQUVWXZKRYPTO\\nEFGHIJLMNQUVWXZKRYPTOSABCD\\nSABCDEFGHIJLMNQUVWXZKRYPTO\\nTOSABCDEFGHIJLMNQUVWXZKRYP]]\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\u003eFollow Up Challenges:\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\u003e1)\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/1500-kryptos-cia-cypher-sculpture-vignere-decryption\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eVigenere Decryption\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2) Dictionary search\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\u003e3) KRYPTOS Part IV\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://math.ucsd.edu/~crypto/Projects/KarlWang/index2.html#1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKRYPTOS Solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1500,"title":"Kryptos - CIA Cypher Sculpture: Vignere Decryption","description":"The \u003chttp://en.wikipedia.org/wiki/Kryptos Kryptos Sculpture\u003e contains four encypted messages.\r\n\r\nThis Challenge is to Decrypt two of the original messages from the sculpture.\r\n\r\nThe method employed is \u003chttp://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher Vigenere Decryption\u003e. One clarification is that \"?\" are removed from the coding sequence and then re-inserted in the final encoded message.\r\n\r\nOriginal phrase: Between subtle shading and the absence of light lies the nuance of iqlusion.\r\n\r\nFor coding purposes spaces and punctuation are removed, except \"?\".\r\n\r\nDecode Phrase: EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD\r\n\r\n\r\n\r\n*Input:* Decode Phrase, Vigenere alphabet word, Vigenere shift word\r\n\r\nVigenere alphabet word ='KRYPTOS';\r\n\r\nVigenere shift word ='PALIMPSEST';\r\n\r\n*Output:* BETWEENSUBTLESHADINGANDTHEABSENCEOFLIGHTLIESTHENUANCEOFIQLUSION\r\n\r\nThe decryption matrix for this case:\r\n\r\n  KRYPTOSABCDEFGHIJLMNQUVWXZ\r\n\r\n  PTOSABCDEFGHIJLMNQUVWXZKRY\r\n  ABCDEFGHIJLMNQUVWXZKRYPTOS\r\n  LMNQUVWXZKRYPTOSABCDEFGHIJ\r\n  IJLMNQUVWXZKRYPTOSABCDEFGH\r\n  MNQUVWXZKRYPTOSABCDEFGHIJL\r\n  PTOSABCDEFGHIJLMNQUVWXZKRY\r\n  SABCDEFGHIJLMNQUVWXZKRYPTO\r\n  EFGHIJLMNQUVWXZKRYPTOSABCD\r\n  SABCDEFGHIJLMNQUVWXZKRYPTO\r\n  TOSABCDEFGHIJLMNQUVWXZKRYP\r\n\r\nFollow Up Challenges:\r\n\r\n1) \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1499-kryptos-cia-cypher-sculpture-vigenere-encryption Vigenere Encryption\u003e\r\n\r\n2) Dictionary search\r\n\r\n3) KRYPTOS Part IV\r\n\r\n\u003chttp://math.ucsd.edu/~crypto/Projects/KarlWang/index2.html#1 KRYPTOS Solutions\u003e","description_html":"\u003cp\u003eThe \u003ca href = \"http://en.wikipedia.org/wiki/Kryptos\"\u003eKryptos Sculpture\u003c/a\u003e contains four encypted messages.\u003c/p\u003e\u003cp\u003eThis Challenge is to Decrypt two of the original messages from the sculpture.\u003c/p\u003e\u003cp\u003eThe method employed is \u003ca href = \"http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher\"\u003eVigenere Decryption\u003c/a\u003e. One clarification is that \"?\" are removed from the coding sequence and then re-inserted in the final encoded message.\u003c/p\u003e\u003cp\u003eOriginal phrase: Between subtle shading and the absence of light lies the nuance of iqlusion.\u003c/p\u003e\u003cp\u003eFor coding purposes spaces and punctuation are removed, except \"?\".\u003c/p\u003e\u003cp\u003eDecode Phrase: EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e Decode Phrase, Vigenere alphabet word, Vigenere shift word\u003c/p\u003e\u003cp\u003eVigenere alphabet word ='KRYPTOS';\u003c/p\u003e\u003cp\u003eVigenere shift word ='PALIMPSEST';\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e BETWEENSUBTLESHADINGANDTHEABSENCEOFLIGHTLIESTHENUANCEOFIQLUSION\u003c/p\u003e\u003cp\u003eThe decryption matrix for this case:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eKRYPTOSABCDEFGHIJLMNQUVWXZ\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003ePTOSABCDEFGHIJLMNQUVWXZKRY\r\nABCDEFGHIJLMNQUVWXZKRYPTOS\r\nLMNQUVWXZKRYPTOSABCDEFGHIJ\r\nIJLMNQUVWXZKRYPTOSABCDEFGH\r\nMNQUVWXZKRYPTOSABCDEFGHIJL\r\nPTOSABCDEFGHIJLMNQUVWXZKRY\r\nSABCDEFGHIJLMNQUVWXZKRYPTO\r\nEFGHIJLMNQUVWXZKRYPTOSABCD\r\nSABCDEFGHIJLMNQUVWXZKRYPTO\r\nTOSABCDEFGHIJLMNQUVWXZKRYP\r\n\u003c/pre\u003e\u003cp\u003eFollow Up Challenges:\u003c/p\u003e\u003cp\u003e1) \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1499-kryptos-cia-cypher-sculpture-vigenere-encryption\"\u003eVigenere Encryption\u003c/a\u003e\u003c/p\u003e\u003cp\u003e2) Dictionary search\u003c/p\u003e\u003cp\u003e3) KRYPTOS Part IV\u003c/p\u003e\u003cp\u003e\u003ca href = \"http://math.ucsd.edu/~crypto/Projects/KarlWang/index2.html#1\"\u003eKRYPTOS Solutions\u003c/a\u003e\u003c/p\u003e","function_template":"function decoded=decode_vigenere(phrase,word1,word2)\r\n decoded=phrase;\r\nend","test_suite":"phrase=upper('Between subtle shading and the absence of light lies the nuance of iqlusion.');\r\ndecoded_exp=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\nphrase_encoded='EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD';\r\nword1='KRYPTOS';\r\nword2='PALIMPSEST';\r\ndecoded= decode_vigenere(phrase_encoded,word1,word2);\r\n\r\nassert(strcmp(decoded_exp,decoded))\r\n\r\n%%\r\nphrase=upper('It was totally invisible Hows that possible? They used the Earths magnetic field X The information was gathered and transmitted undergruund to an unknown location X Does Langley know about this? They should Its buried out there somewhere X Who knows the exact location? Only WW This was his last message X Thirty eight degrees fifty seven minutes six point five seconds north Seventy seven degrees eight minutes forty four seconds west ID by rows');\r\ndecoded_exp=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\nphrase_encoded='VFPJUDEEHZWETZYVGWHKKQETGFQJNCEGGWHKK?DQMCPFQZDQMMIAGPFXHQRLGTIMVMZJANQLVKQEDAGDVFRPJUNGEUNAQZGZLECGYUXUEENJTBJLBQCRTBJDFHRRYIZETKZEMVDUFKSJHKFWHKUWQLSZFTIHHDDDUVH?DWKBFUFPWNTDFIYCUQZEREEVLDKFEZMOQQJLTTUGSYQPFEUNLAVIDXFLGGTEZ?FKZBSFDQVGOGIPUFXHHDRKFFHQNTGPUAECNUVPDJMQCLQUMUNEDFQELZZVRRGKFFVOEEXBDMVPNFQXEZLGREDNQFMPNZGLFLPMRJQYALMGNUVPDXVKPDQUMEBEDMHDAFMJGZNUPLGEWJLLAETG';\r\n\r\nword1='KRYPTOS';\r\nword2='ABSCISSA';\r\ndecoded= decode_vigenere(phrase_encoded,word1,word2);\r\n\r\nassert(strcmp(decoded_exp,decoded))\r\n\r\n%%\r\nphrase=upper('The fox jumped over the moon');\r\ndecoded_exp=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\nphrase_encoded='VUIPFSBYVQMMWPIMEVPZCVK';\r\nword1='KRYPTOS';\r\nword2='MATLAB';\r\ndecoded= decode_vigenere(phrase_encoded,word1,word2);\r\n\r\nassert(strcmp(decoded_exp,decoded))\r\n\r\n%%\r\nphrase=upper('Between the Devil and the deep blue sea');\r\ndecoded_exp=phrase(regexp(phrase,'[A-Z?]'));\r\n\r\nphrase_encoded='SENMEDWTZNDDFIBLNNCHVTEDIBBCEZOA';\r\nword1='AWEIGH';\r\nword2='MATLAB';\r\ndecoded= decode_vigenere(phrase_encoded,word1,word2);\r\n\r\nassert(strcmp(decoded_exp,decoded))","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":60,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-05-11T22:20:55.000Z","updated_at":"2026-03-08T03:54:47.000Z","published_at":"2013-05-11T22:27:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe\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://en.wikipedia.org/wiki/Kryptos\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKryptos Sculpture\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e contains four encypted messages.\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 Challenge is to Decrypt two of the original messages from the sculpture.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe method employed is\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://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eVigenere Decryption\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. One clarification is that \\\"?\\\" are removed from the coding sequence and then re-inserted in the final encoded message.\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\u003eOriginal phrase: Between subtle shading and the absence of light lies the nuance of iqlusion.\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 coding purposes spaces and punctuation are removed, except \\\"?\\\".\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\u003eDecode Phrase: EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Decode Phrase, Vigenere alphabet word, Vigenere shift word\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\u003eVigenere alphabet word ='KRYPTOS';\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\u003eVigenere shift word ='PALIMPSEST';\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e BETWEENSUBTLESHADINGANDTHEABSENCEOFLIGHTLIESTHENUANCEOFIQLUSION\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe decryption matrix for this case:\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[KRYPTOSABCDEFGHIJLMNQUVWXZ\\n\\nPTOSABCDEFGHIJLMNQUVWXZKRY\\nABCDEFGHIJLMNQUVWXZKRYPTOS\\nLMNQUVWXZKRYPTOSABCDEFGHIJ\\nIJLMNQUVWXZKRYPTOSABCDEFGH\\nMNQUVWXZKRYPTOSABCDEFGHIJL\\nPTOSABCDEFGHIJLMNQUVWXZKRY\\nSABCDEFGHIJLMNQUVWXZKRYPTO\\nEFGHIJLMNQUVWXZKRYPTOSABCD\\nSABCDEFGHIJLMNQUVWXZKRYPTO\\nTOSABCDEFGHIJLMNQUVWXZKRYP]]\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\u003eFollow Up Challenges:\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\u003e1)\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/1499-kryptos-cia-cypher-sculpture-vigenere-encryption\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eVigenere Encryption\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e2) Dictionary search\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\u003e3) KRYPTOS Part IV\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://math.ucsd.edu/~crypto/Projects/KarlWang/index2.html#1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eKRYPTOS Solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1576,"title":"Mean and standard deviation of times in string","description":"Input(t) - cell of strings with times in format 'min:sec.ms'\r\n\r\nOutput([m, s]) - two strings with mean and standard deviation with the same format (rounded to first decimal place)\r\n\r\nExample:\r\n\r\n* t={'45.5', '1:04.8', '55.4'}; m='55.2'; s='9.7';\r\n* t={'1:38.4', '2:12.9', '2:00.6'}; m='1:57.3'; s='17.5'","description_html":"\u003cp\u003eInput(t) - cell of strings with times in format 'min:sec.ms'\u003c/p\u003e\u003cp\u003eOutput([m, s]) - two strings with mean and standard deviation with the same format (rounded to first decimal place)\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cul\u003e\u003cli\u003et={'45.5', '1:04.8', '55.4'}; m='55.2'; s='9.7';\u003c/li\u003e\u003cli\u003et={'1:38.4', '2:12.9', '2:00.6'}; m='1:57.3'; s='17.5'\u003c/li\u003e\u003c/ul\u003e","function_template":"function [m, s] = mean_std(t)\r\n  m = t;\r\n  s = t;\r\nend","test_suite":"%%\r\nx = {'45.5','1:04.8','55.4'};\r\ny_correct = '55.2';\r\nz_correct = '9.7'\r\n[a,b]=mean_std(x);\r\nassert(isequal(a,y_correct)\u0026isequal(b,z_correct))\r\n\r\n%%\r\nx = {'1:38.4','2:12.9','2:00.6'};\r\ny_correct = '1:57.3';\r\nz_correct = '17.5';\r\n[a,b]=mean_std(x);\r\nassert(isequal(a,y_correct)\u0026isequal(b,z_correct))\r\n\r\n%%\r\nx = {'10:00.0','5:00.0','3:00.0','1:00.0'};\r\ny_correct = '4:45.0';\r\nz_correct = '3:51.7';\r\n[a,b]=mean_std(x);\r\nassert(isequal(a,y_correct)\u0026isequal(b,z_correct))\r\n\r\n%%\r\nx = {'1:01.1','2:02.2','3:03.3','4:04.4'};\r\ny_correct = '2:32.8';\r\nz_correct = '1:18.9';\r\n[a,b]=mean_std(x);\r\nassert(isequal(a,y_correct)\u0026isequal(b,z_correct))\r\n\r\n%%\r\nx = {'50.7','1:02.3','59.4','57.3','1:00.4'};\r\ny_correct = '58.0';\r\nz_correct = '4.5';\r\n[a,b]=mean_std(x);\r\nassert(isequal(a,y_correct)\u0026isequal(b,z_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":14249,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":77,"test_suite_updated_at":"2017-05-31T17:17:26.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-06-06T12:22:15.000Z","updated_at":"2026-03-08T05:16:11.000Z","published_at":"2013-06-06T12:22:15.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\u003eInput(t) - cell of strings with times in format 'min:sec.ms'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput([m, s]) - two strings with mean and standard deviation with the same format (rounded to first decimal place)\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003et={'45.5', '1:04.8', '55.4'}; m='55.2'; s='9.7';\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003et={'1:38.4', '2:12.9', '2:00.6'}; m='1:57.3'; s='17.5'\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":1579,"title":"How many digits are there?","description":"Input(s) - any string\r\n\r\nOutput(n) - number of digits within string s","description_html":"\u003cp\u003eInput(s) - any string\u003c/p\u003e\u003cp\u003eOutput(n) - number of digits within string s\u003c/p\u003e","function_template":"function n = digits(s)\r\n  n = s;\r\nend","test_suite":"%%\r\nx = 'anbduybefiafn29128r4 ybzw';\r\ny_correct = 6;\r\nassert(isequal(digits(x),y_correct))\r\n\r\n%%\r\nx = 'anuk32y7rhcscbniv82 bv7hf bA^#2tR*Gqvg';\r\ny_correct = 7;\r\nassert(isequal(digits(x),y_correct))\r\n\r\n%%\r\nx = '1234567890';\r\ny_correct = 10;\r\nassert(isequal(digits(x),y_correct))\r\n\r\n%%\r\nx = 'a1b2c3d4e5f6g7h8i9';\r\ny_correct = 9;\r\nassert(isequal(digits(x),y_correct))\r\n\r\n%%\r\nx = 's;dfj98798324k kds $:J(%*n 34 ;ljkasr87 34w ;lkj3 aoij5l;j;q 35';\r\ny_correct = 18;\r\nassert(isequal(digits(x),y_correct))\r\n\r\n%%\r\nx = num2str(1:100);\r\ny_correct = 192;\r\nassert(isequal(digits(x),y_correct))\r\n\r\n%%\r\nx = 'The answer is 42.';\r\ny_correct = 2;\r\nassert(isequal(digits(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":14249,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":273,"test_suite_updated_at":"2017-05-31T17:23:47.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-06-06T12:59:48.000Z","updated_at":"2026-02-22T01:55:46.000Z","published_at":"2013-06-06T12:59: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\u003eInput(s) - any 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\u003eOutput(n) - number of digits within string s\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":1641,"title":"ABBREVIATION","description":"Abbreviate the given string. Consider Only Capital Letters.\r\n\r\nEXAMPLE\r\n\r\nIf input is 'Abbreviation of The Given String' then output should be 'A T G S '.\r\nNote: There should be a space at the end of the abbreviated word.","description_html":"\u003cp\u003eAbbreviate the given string. Consider Only Capital Letters.\u003c/p\u003e\u003cp\u003eEXAMPLE\u003c/p\u003e\u003cp\u003eIf input is 'Abbreviation of The Given String' then output should be 'A T G S '.\r\nNote: There should be a space at the end of the abbreviated word.\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx ='Abbreviation of The Given String';\r\ny_correct = 'A T G S ';\r\nassert(strcmp(your_fcn_name(x),y_correct)==1)\r\n\r\n%%\r\nx ='The Propose is to Make ABBREBIATION';\r\ny_correct = 'T P M A ';\r\nassert(strcmp(your_fcn_name(x),y_correct)==1)\r\n\r\n%\r\nx ='The MATLAB Coder';\r\ny_correct = 'T M C ';\r\nassert(strcmp(your_fcn_name(x),y_correct)==1)","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":13514,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":137,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-06-10T10:47:45.000Z","updated_at":"2026-03-21T03:51:45.000Z","published_at":"2013-06-10T10:47:45.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\u003eAbbreviate the given string. Consider Only Capital Letters.\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\u003eIf input is 'Abbreviation of The Given String' then output should be 'A T G S '. Note: There should be a space at the end of the abbreviated word.\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":1682,"title":"Make a list string","description":"Given a cell string, produce a string separating the items with spaces and commas and with an 'and' preceding the final item, and ending with a full stop.\r\n\r\nInput x = {'apples' 'oranges' 'pears' 'salmon'}\r\n\r\nOutput y = 'apples, oranges, pears and salmon.'\r\n","description_html":"\u003cp\u003eGiven a cell string, produce a string separating the items with spaces and commas and with an 'and' preceding the final item, and ending with a full stop.\u003c/p\u003e\u003cp\u003eInput x = {'apples' 'oranges' 'pears' 'salmon'}\u003c/p\u003e\u003cp\u003eOutput y = 'apples, oranges, pears and salmon.'\u003c/p\u003e","function_template":"function y = make_list(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = {'apples' 'oranges' 'pears' 'salmon'};\r\ny_correct = 'apples, oranges, pears and salmon.';\r\nassert(isequal(make_list(x),y_correct))\r\n\r\n%%\r\nx = {'1' '23' '4' 'potatoes'};\r\ny_correct = '1, 23, 4 and potatoes.';\r\nassert(isequal(make_list(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":15191,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":147,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-06-27T15:57:14.000Z","updated_at":"2026-02-22T02:15:25.000Z","published_at":"2013-06-27T15:57:55.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a cell string, produce a string separating the items with spaces and commas and with an 'and' preceding the final item, and ending with a full stop.\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 x = {'apples' 'oranges' 'pears' 'salmon'}\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 y = 'apples, oranges, pears and salmon.'\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":1686,"title":"Generate a melodic contour string matrix","description":"\u003chttp://en.wikipedia.org/wiki/Parsons_code Parsons code\u003e is a surprisingly effective way to identify music by its melodic motion. That is, with each successive note, does the pitch go up, down, or stay the same. No effort is made to capture the length of the interval between notes. The result is a lossy but useful \"thumbprint\" of a musical piece.\r\n\r\nYou will be given a string in Parsons code. By convention, the first note is denoted by *. Each note thereafter is either \"u\" for up, \"d\" for down, or \"r\" for repeat. The expected output is a string matrix showing the tune's contour. It can contain only space, star, dash, forward slash, and backward slash (ASCII values 32, 42, 45, 47, and 92 respectively). The output matrix should be the smallest possible bounding box that can contain all the nonspace characters. That is, there should be no empty rows or columns.\r\n\r\nExamples:\r\n\r\n str = '*rrr'\r\n melody = '*-*-*-*'\r\n\r\n str = '*du'\r\n melody = ['*   *'\r\n           ' \\ / '\r\n           '  *  ']\r\n\r\n The \"Happy Birthday\" song!\r\n str = '*rududdrudud'\r\n melody = ['    *   *              '\r\n           '   / \\ / \\             '\r\n           '*-*   *   *     *   *  '\r\n           '           \\   / \\ / \\ '\r\n           '            *-*   *   *']\r\n","description_html":"\u003cp\u003e\u003ca href = \"http://en.wikipedia.org/wiki/Parsons_code\"\u003eParsons code\u003c/a\u003e is a surprisingly effective way to identify music by its melodic motion. That is, with each successive note, does the pitch go up, down, or stay the same. No effort is made to capture the length of the interval between notes. The result is a lossy but useful \"thumbprint\" of a musical piece.\u003c/p\u003e\u003cp\u003eYou will be given a string in Parsons code. By convention, the first note is denoted by *. Each note thereafter is either \"u\" for up, \"d\" for down, or \"r\" for repeat. The expected output is a string matrix showing the tune's contour. It can contain only space, star, dash, forward slash, and backward slash (ASCII values 32, 42, 45, 47, and 92 respectively). The output matrix should be the smallest possible bounding box that can contain all the nonspace characters. That is, there should be no empty rows or columns.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cpre\u003e str = '*rrr'\r\n melody = '*-*-*-*'\u003c/pre\u003e\u003cpre\u003e str = '*du'\r\n melody = ['*   *'\r\n           ' \\ / '\r\n           '  *  ']\u003c/pre\u003e\u003cpre\u003e The \"Happy Birthday\" song!\r\n str = '*rududdrudud'\r\n melody = ['    *   *              '\r\n           '   / \\ / \\             '\r\n           '*-*   *   *     *   *  '\r\n           '           \\   / \\ / \\ '\r\n           '            *-*   *   *']\u003c/pre\u003e","function_template":"function melody = parsons(str)\r\n  melody = '';\r\nend","test_suite":"%%\r\nstr = '*rrr';\r\nmelody = '*-*-*-*';\r\nassert(strcmp(parsons(str),melody))\r\n\r\n%%\r\nstr = '*du';\r\nmelody = ['*   *'\r\n          ' \\ / '\r\n          '  *  '];\r\nassert(strcmp(parsons(str),melody))\r\n\r\n%%\r\nstr = '*ruuddduur';\r\nmelody = ['      *            '\r\n          '     / \\           '\r\n          '    *   *       *-*'\r\n          '   /     \\     /   '\r\n          '*-*       *   *    '\r\n          '           \\ /     '\r\n          '            *      '];\r\nassert(strcmp(parsons(str),melody))\r\n\r\n%%\r\nstr = '*rududdrudud';\r\nmelody = ['    *   *              '\r\n          '   / \\ / \\             '\r\n          '*-*   *   *     *   *  '\r\n          '           \\   / \\ / \\ '\r\n          '            *-*   *   *'];\r\nassert(strcmp(parsons(str),melody))\r\n\r\n%%\r\nstr = '*rururddrdrdrd';\r\nmelody = ['        *-*                '\r\n          '       /   \\               '\r\n          '    *-*     *              '\r\n          '   /         \\             '\r\n          '*-*           *-*          '\r\n          '                 \\         '\r\n          '                  *-*      '\r\n          '                     \\     '\r\n          '                      *-*  '\r\n          '                         \\ '\r\n          '                          *'];\r\nassert(strcmp(parsons(str),melody))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":5,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":66,"test_suite_updated_at":"2013-06-28T21:54:09.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-06-28T16:35:18.000Z","updated_at":"2026-01-14T13:54:31.000Z","published_at":"2013-06-28T17:14:54.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Parsons_code\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eParsons code\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a surprisingly effective way to identify music by its melodic motion. That is, with each successive note, does the pitch go up, down, or stay the same. No effort is made to capture the length of the interval between notes. The result is a lossy but useful \\\"thumbprint\\\" of a musical piece.\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\u003eYou will be given a string in Parsons code. By convention, the first note is denoted by\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e *\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. Each note thereafter is either \\\"u\\\" for up, \\\"d\\\" for down, or \\\"r\\\" for repeat. The expected output is a string matrix showing the tune's contour. It can contain only space, star, dash, forward slash, and backward slash (ASCII values 32, 42, 45, 47, and 92 respectively). The output matrix should be the smallest possible bounding box that can contain all the nonspace characters. That is, there should be no empty rows or columns.\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\u003eExamples:\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[ str = '*rrr'\\n melody = '*-*-*-*'\\n\\n str = '*du'\\n melody = ['*   *'\\n           ' \\\\ / '\\n           '  *  ']\\n\\n The \\\"Happy Birthday\\\" song!\\n str = '*rududdrudud'\\n melody = ['    *   *              '\\n           '   / \\\\ / \\\\             '\\n           '*-*   *   *     *   *  '\\n           '           \\\\   / \\\\ / \\\\ '\\n           '            *-*   *   *']]]\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":1696,"title":"Morse Code Generator! Try it!","description":"  .... . .-.. .-.. ---     . ...- . .-. -.-- --- -. . -.-.-- \r\n        .-.. . - ...       -.. ---       ... --- -- .       -- --- .-. ... .       -.-. --- -.. . -.-.--             .-- . .-.. .-..       - .... .. ...       -- --- .-. ... .       -.-. --- -.. .       --. . -. . .-. .- - --- .-.       ..- ... . ...       - .... .       .. -. - . .-. -. .- - .. --- -. .- .-..       ... - -.-- .-.. .       -- --- .-. ... .       -.-. --- -.. . .-.-.-             - .... .       .-.-.-       .- -. -..              -- .- -.- .       ..- .--.       .- .-.. .-..       - .... .       -.-. --- -.. . --..--       - .... . .-. .       .. ...       --- -. .       ... .--. .- -.-. .       - .... .- -       ... . .--. .- .-. .- - . ...       .-.. . - - . .-. ...       .- -. -..       .....       ... .--. .- -.-. . ...       - .... .- -       ... . .--. .- .-. .- - .       .-- --- .-. -.. ... .-.-.-             ... --- -- .       .--. ..- -. -.-. - ..- .- - .. --- -.       .. ...       ..- ... . -.. .-.-.- .-.-.- .-.-.-             --- - .... . .-.       - .... . -.       - .... .- - --..--       .- .-.. .-..       -.-- --- ..-       -. . . -..       - ---       -.. ---       .. ...       - .- -.- .       .. -.       ... --- -- .       - -.-- .--. .       --- ..-.       - . -..- -       .. -.       - .... .       ..-. --- .-. --       --- ..-.       .-       ... - .-. .. -. --.       .- -. -..       - ..- .-. -.       .. -       .. -. - ---       .-       -- --- .-. ... .       -.-. --- -.. .       .-.. .. -. .        -.-. .... .- .-.       -.-. .-.. .- ... ...  --..--       .- ...       - .... .       . -..- .- -- .--. .-.. .       -... . .-.. --- .--       ... .... --- .-- ...  \r\n  \r\n\r\n\r\n  \r\n\r\n  text = 'Morse code is FUN!'\r\n  Morse_code_out = '-- --- .-. ... .       -.-. --- -.. .       .. ...       ..-. ..- -. -.-.--'\r\n\r\n\r\nJust a note: this uses international style Morse code found in:\r\n\r\nhttp://en.wikipedia.org/wiki/American_Morse_code\r\n","description_html":"\u003cpre class=\"language-matlab\"\u003e.... . .-.. .-.. ---     . ...- . .-. -.-- --- -. . -.-.-- \r\n      .-.. . - ...       -.. ---       ... --- -- .       -- --- .-. ... .       -.-. --- -.. . -.-.--             .-- . .-.. .-..       - .... .. ...       -- --- .-. ... .       -.-. --- -.. .       --. . -. . .-. .- - --- .-.       ..- ... . ...       - .... .       .. -. - . .-. -. .- - .. --- -. .- .-..       ... - -.-- .-.. .       -- --- .-. ... .       -.-. --- -.. . .-.-.-             - .... .       .-.-.-       .- -. -..              -- .- -.- .       ..- .--.       .- .-.. .-..       - .... .       -.-. --- -.. . --..--       - .... . .-. .       .. ...       --- -. .       ... .--. .- -.-. .       - .... .- -       ... . .--. .- .-. .- - . ...       .-.. . - - . .-. ...       .- -. -..       .....       ... .--. .- -.-. . ...       - .... .- -       ... . .--. .- .-. .- - .       .-- --- .-. -.. ... .-.-.-             ... --- -- .       .--. ..- -. -.-. - ..- .- - .. --- -.       .. ...       ..- ... . -.. .-.-.- .-.-.- .-.-.-             --- - .... . .-.       - .... . -.       - .... .- - --..--       .- .-.. .-..       -.-- --- ..-       -. . . -..       - ---       -.. ---       .. ...       - .- -.- .       .. -.       ... --- -- .       - -.-- .--. .       --- ..-.       - . -..- -       .. -.       - .... .       ..-. --- .-. --       --- ..-.       .-       ... - .-. .. -. --.       .- -. -..       - ..- .-. -.       .. -       .. -. - ---       .-       -- --- .-. ... .       -.-. --- -.. .       .-.. .. -. .        -.-. .... .- .-.       -.-. .-.. .- ... ...  --..--       .- ...       - .... .       . -..- .- -- .--. .-.. .       -... . .-.. --- .--       ... .... --- .-- ...  \r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003etext = 'Morse code is FUN!'\r\nMorse_code_out = '-- --- .-. ... .       -.-. --- -.. .       .. ...       ..-. ..- -. -.-.--'\r\n\u003c/pre\u003e\u003cp\u003eJust a note: this uses international style Morse code found in:\u003c/p\u003e\u003cp\u003e\u003ca href = \"http://en.wikipedia.org/wiki/American_Morse_code\"\u003ehttp://en.wikipedia.org/wiki/American_Morse_code\u003c/a\u003e\u003c/p\u003e","function_template":"function Morse_code_out = MorseCodeGenerator(text)\r\n  Morse_code_out = text_in;\r\nend","test_suite":"%%\r\nx = 'Morse code is FUN!';\r\ny_correct = '-- --- .-. ... .     -.-. --- -.. .     .. ...     ..-. ..- -. -.-.--';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n%%\r\nx = 'Am I 20, (who knows?)';\r\ny_correct = '.- --     ..     ..--- ----- --..--     -.--. .-- .... ---     -.- -. --- .-- ... ..--.. -.--.-';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n%%\r\nx = 'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG: or does he...';\r\ny_correct = '- .... .     --.- ..- .. -.-. -.-     -... .-. --- .-- -.     ..-. --- -..-     .--- ..- -- .--. ...     --- ...- . .-.     - .... .     .-.. .- --.. -.--     -.. --- --. ---...     --- .-.     -.. --- . ...     .... . .-.-.- .-.-.- .-.-.-';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n%%\r\nx = '1234567890';\r\ny_correct = '.---- ..--- ...-- ....- ..... -.... --... ---.. ----. -----';\r\nassert(isequal(MorseCodeGenerator(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":92,"test_suite_updated_at":"2019-09-16T11:37:52.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-07-05T18:50:09.000Z","updated_at":"2025-12-29T01:11:58.000Z","published_at":"2013-07-09T15:55:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[.... . .-.. .-.. ---     . ...- . .-. -.-- --- -. . -.-.-- \\n      .-.. . - ...       -.. ---       ... --- -- .       -- --- .-. ... .       -.-. --- -.. . -.-.--             .-- . .-.. .-..       - .... .. ...       -- --- .-. ... .       -.-. --- -.. .       --. . -. . .-. .- - --- .-.       ..- ... . ...       - .... .       .. -. - . .-. -. .- - .. --- -. .- .-..       ... - -.-- .-.. .       -- --- .-. ... .       -.-. --- -.. . .-.-.-             - .... .       .-.-.-       .- -. -..              -- .- -.- .       ..- .--.       .- .-.. .-..       - .... .       -.-. --- -.. . --..--       - .... . .-. .       .. ...       --- -. .       ... .--. .- -.-. .       - .... .- -       ... . .--. .- .-. .- - . ...       .-.. . - - . .-. ...       .- -. -..       .....       ... .--. .- -.-. . ...       - .... .- -       ... . .--. .- .-. .- - .       .-- --- .-. -.. ... .-.-.-             ... --- -- .       .--. ..- -. -.-. - ..- .- - .. --- -.       .. ...       ..- ... . -.. .-.-.- .-.-.- .-.-.-             --- - .... . .-.       - .... . -.       - .... .- - --..--       .- .-.. .-..       -.-- --- ..-       -. . . -..       - ---       -.. ---       .. ...       - .- -.- .       .. -.       ... --- -- .       - -.-- .--. .       --- ..-.       - . -..- -       .. -.       - .... .       ..-. --- .-. --       --- ..-.       .-       ... - .-. .. -. --.       .- -. -..       - ..- .-. -.       .. -       .. -. - ---       .-       -- --- .-. ... .       -.-. --- -.. .       .-.. .. -. .        -.-. .... .- .-.       -.-. .-.. .- ... ...  --..--       .- ...       - .... .       . -..- .- -- .--. .-.. .       -... . .-.. --- .--       ... .... --- .-- ...  \\n\\ntext = 'Morse code is FUN!'\\nMorse_code_out = '-- --- .-. ... .       -.-. --- -.. .       .. ...       ..-. ..- -. -.-.--']]\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\u003eJust a note: this uses international style Morse code found in:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/American_Morse_code\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/American_Morse_code\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1712,"title":"NO _________ ALLOWED....","description":"So you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0.  For example:\r\n\r\n  Sentence = 'The birds in the field are eating bird seed';\r\n  Not_allowed = 'field'\r\n\r\nso the output will be, because field is found in the sentence:\r\n\r\n  Output = 1; \r\n\r\nAnother example:\r\n\r\n  Sentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\n  Not_allowed = 'oven'\r\n\r\nso the output will be, because oven is not found in the sentence:\r\n\r\n  Output = 0; \r\n\r\nThat is it!\r\n\r\nHave Fun!","description_html":"\u003cp\u003eSo you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0.  For example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSentence = 'The birds in the field are eating bird seed';\r\nNot_allowed = 'field'\r\n\u003c/pre\u003e\u003cp\u003eso the output will be, because field is found in the sentence:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eOutput = 1; \r\n\u003c/pre\u003e\u003cp\u003eAnother example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\nNot_allowed = 'oven'\r\n\u003c/pre\u003e\u003cp\u003eso the output will be, because oven is not found in the sentence:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eOutput = 0; \r\n\u003c/pre\u003e\u003cp\u003eThat is it!\u003c/p\u003e\u003cp\u003eHave Fun!\u003c/p\u003e","function_template":"function output = NotAllowed(Sentence, Not_allowed)\r\n  output = Not_allowed;\r\n  output = Sentence;\r\nend","test_suite":"%%\r\nSentence = 'The birds in the field are eating bird seed';\r\nNot_allowed = 'field'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\nNot_allowed = 'oven'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Oh where, oh where has my little dog gone?';\r\nNot_allowed = 'where'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Insanity: doing the same thing over and over again and expecting different results...';\r\nNot_allowed = 'Einstein'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Wheres the cream filling?';\r\nNot_allowed = 'cream'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'MATLAB is the coolest!';\r\nNot_allowed = 'MATLAB'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'No no, you got it all wrong!';\r\nNot_allowed = 'No'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'This planet, with all its appalling immensity, is to electric currents virtually no more than a small metal ball.';\r\nNot_allowed = 'Tesla'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":226,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-07-12T16:08:38.000Z","updated_at":"2026-02-22T02:23:52.000Z","published_at":"2013-07-12T16:08:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0. For 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[Sentence = 'The birds in the field are eating bird seed';\\nNot_allowed = 'field']]\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\u003eso the output will be, because field is found in the sentence:\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[Output = 1;]]\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\u003eAnother 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[Sentence = 'If the sky is blue on earth, what is the sky color on mars?';\\nNot_allowed = 'oven']]\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\u003eso the output will be, because oven is not found in the sentence:\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[Output = 0;]]\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\u003eThat is it!\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\u003eHave Fun!\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":1721,"title":"Backslang, odds are you used it at some point in time...","description":"So backslang is a language that can be used to communicate in an easy decode code, if people know the rules of decoding it.  Well this backslang follows rules that are fairly customary. You take the first letter of a word and put it in the end, then add 'ay' on the end. \r\n\r\nHatstay tiay! Onay oremay onay esslay. Ellway erehay reaay omesay xampleseay:\r\n\r\n  str = 'The sky is falling, the sky is falling, or is it?'\r\n\r\n  output = Hetay kysay siay allingfay, hetay kysay siay allingfay, roay siay tiay?\r\n\r\nUstjay aay otenay, omesay unctuationpay ndaay apitalscay oday ountcay.\r\n\r\nOodgay Ucklay!","description_html":"\u003cp\u003eSo backslang is a language that can be used to communicate in an easy decode code, if people know the rules of decoding it.  Well this backslang follows rules that are fairly customary. You take the first letter of a word and put it in the end, then add 'ay' on the end.\u003c/p\u003e\u003cp\u003eHatstay tiay! Onay oremay onay esslay. Ellway erehay reaay omesay xampleseay:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003estr = 'The sky is falling, the sky is falling, or is it?'\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eoutput = Hetay kysay siay allingfay, hetay kysay siay allingfay, roay siay tiay?\r\n\u003c/pre\u003e\u003cp\u003eUstjay aay otenay, omesay unctuationpay ndaay apitalscay oday ountcay.\u003c/p\u003e\u003cp\u003eOodgay Ucklay!\u003c/p\u003e","function_template":"function output = backslang(str)\r\n  output = str;\r\nend","test_suite":"%%\r\nstr = 'The sky is falling, the sky is falling, or is it?'\r\noutput = 'Hetay kysay siay allingfay, hetay kysay siay allingfay, roay siay tiay?'\r\nassert(isequal(backslang(str),output))\r\n%%\r\nstr = 'If Allen is Janes husband and Tom is Jill husband, who is Roys wife?'\r\noutput = 'Fiay Llenaay siay Anesjay usbandhay ndaay Omtay siay Illjay usbandhay, howay siay Oysray ifeway?'\r\nassert(isequal(backslang(str),output))\r\n%%\r\nstr = 'This is the sentence I will use.'\r\noutput = 'Histay siay hetay entencesay Iay illway seuay.'\r\nassert(isequal(backslang(str),output))\r\n%%\r\nstr = 'Christopher Columbus sailed the ocean blue!'\r\noutput = 'Hristophercay Olumbuscay ailedsay hetay ceanoay luebay!'\r\nassert(isequal(backslang(str),output))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-07-17T16:39:49.000Z","updated_at":"2026-03-09T02:10:26.000Z","published_at":"2013-07-17T16:39:52.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\u003eSo backslang is a language that can be used to communicate in an easy decode code, if people know the rules of decoding it. Well this backslang follows rules that are fairly customary. You take the first letter of a word and put it in the end, then add 'ay' on the end.\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\u003eHatstay tiay! Onay oremay onay esslay. Ellway erehay reaay omesay xampleseay:\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[str = 'The sky is falling, the sky is falling, or is it?'\\n\\noutput = Hetay kysay siay allingfay, hetay kysay siay allingfay, roay siay tiay?]]\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\u003eUstjay aay otenay, omesay unctuationpay ndaay apitalscay oday ountcay.\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\u003eOodgay Ucklay!\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":1953,"title":"Simple Caesar Cypher - shift encrypt a message given an index number","description":"A Caesar cypher is a simple shift encryption method. Your goal is to create a function that allows a user to input a string and a shift index and outputs the shifted cypher-text as a string.\r\n\r\nThe shift index is an integer that tells the encryption method how many letters to shift each letter in the message forward. For example, a shift index of 3 will shift the letter \"a\" to be \"d\", \"b\" to be \"e\" and so on. In this problem we will just use the 26 lowercase letters in the english alphabet, and any capital letters in the message should be converted to lowercase. The ordering of letters will wrap around after \"z\", so that a \"y\" shifted by 3 will become a \"b\".\r\n\r\nAny integer number (positive, negative, and of any magnitude) should be acceptable as the shift index.\r\n\r\nExamples:\r\n\r\ncaesarShift('zebra',7) --\u003e 'gliyh'\r\n\r\ncaesarShift('LiOn',-5) --\u003e 'gdji'","description_html":"\u003cp\u003eA Caesar cypher is a simple shift encryption method. Your goal is to create a function that allows a user to input a string and a shift index and outputs the shifted cypher-text as a string.\u003c/p\u003e\u003cp\u003eThe shift index is an integer that tells the encryption method how many letters to shift each letter in the message forward. For example, a shift index of 3 will shift the letter \"a\" to be \"d\", \"b\" to be \"e\" and so on. In this problem we will just use the 26 lowercase letters in the english alphabet, and any capital letters in the message should be converted to lowercase. The ordering of letters will wrap around after \"z\", so that a \"y\" shifted by 3 will become a \"b\".\u003c/p\u003e\u003cp\u003eAny integer number (positive, negative, and of any magnitude) should be acceptable as the shift index.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cp\u003ecaesarShift('zebra',7) --\u003e 'gliyh'\u003c/p\u003e\u003cp\u003ecaesarShift('LiOn',-5) --\u003e 'gdji'\u003c/p\u003e","function_template":"function cyphertext = caesarShift(message, shift)\r\ncyphertext=message;\r\nend","test_suite":"%%\r\nmessage = 'elephant';\r\nshift = 45;\r\ncorrect = 'xexiatgm';\r\nassert(isequal(caesarShift(message,shift),correct))\r\n\r\n%%\r\nmessage = 'TiGEr';\r\nshift = -537;\r\nanswer = 'crpna';\r\nassert(isequal(caesarShift(message,shift),answer))\r\n\r\n%%\r\nmessage = 'gozoaobrsf'\r\nshift = 12;\r\nanswer = 'salamander';\r\nassert(isequal(caesarShift(message,shift),answer))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":1,"created_by":15293,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":110,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-10-21T17:12:02.000Z","updated_at":"2026-03-06T20:51:45.000Z","published_at":"2013-10-21T17:12: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\u003eA Caesar cypher is a simple shift encryption method. Your goal is to create a function that allows a user to input a string and a shift index and outputs the shifted cypher-text 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\u003eThe shift index is an integer that tells the encryption method how many letters to shift each letter in the message forward. For example, a shift index of 3 will shift the letter \\\"a\\\" to be \\\"d\\\", \\\"b\\\" to be \\\"e\\\" and so on. In this problem we will just use the 26 lowercase letters in the english alphabet, and any capital letters in the message should be converted to lowercase. The ordering of letters will wrap around after \\\"z\\\", so that a \\\"y\\\" shifted by 3 will become a \\\"b\\\".\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\u003eAny integer number (positive, negative, and of any magnitude) should be acceptable as the shift index.\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\u003eExamples:\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\u003ecaesarShift('zebra',7) --\u003e 'gliyh'\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\u003ecaesarShift('LiOn',-5) --\u003e 'gdji'\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":2073,"title":"Split a given string from the first instance of a given character","description":"A simple operation to split a given string into two substrings at the point where the desired character is first found. e.g. \r\n\r\ninputString: 'we have 6 cars'  split it from '6'\r\n\r\noutput: 'we have ' and '6 cars'\r\n\r\nIf the desired character is not found then first substring is same as the whole string and the second string is empty string, i.e. y2='';","description_html":"\u003cp\u003eA simple operation to split a given string into two substrings at the point where the desired character is first found. e.g.\u003c/p\u003e\u003cp\u003einputString: 'we have 6 cars'  split it from '6'\u003c/p\u003e\u003cp\u003eoutput: 'we have ' and '6 cars'\u003c/p\u003e\u003cp\u003eIf the desired character is not found then first substring is same as the whole string and the second string is empty string, i.e. y2='';\u003c/p\u003e","function_template":"function [y1,y2] = SplitString(x,divider)\r\n  y1=0;\r\n  y2=0;\r\nend\r\n\r\n","test_suite":"%%\r\nx='I want to split this: from this';\r\n[y1,y2] = SplitString(x,':');\r\n\r\ny1_correct = 'I want to split this';\r\ny2_correct = ': from this';\r\n\r\nassert(isequal(y1,y1_correct))\r\nassert(isequal(y2,y2_correct))\r\n\r\n%%\r\nx='This one does not have the divider';\r\n[y1,y2] = SplitString(x,':')\r\n\r\ny1_correct = 'This one does not have the divider'\r\ny2_correct = ''\r\n\r\nassert(isequal(y1,y1_correct))\r\nassert(isequal(y2,y2_correct))\r\n\r\n%%\r\nx='This sentence should, not have a comma.';\r\n[y1,y2] = SplitString(x,',')\r\n\r\ny1_correct = 'This sentence should'\r\ny2_correct = ', not have a comma.'\r\n\r\nassert(isequal(y1,y1_correct))\r\nassert(isequal(y2,y2_correct))\r\n\r\n%%\r\nx='Divide only @ at the @ first instance of @.';\r\n[y1,y2] = SplitString(x,'@')\r\n\r\ny1_correct = 'Divide only '\r\ny2_correct = '@ at the @ first instance of @.'\r\n\r\nassert(isequal(y1,y1_correct))\r\nassert(isequal(y2,y2_correct))\r\n\r\n%%\r\nx='Take that, and this, and something else.';\r\n[y1,y2] = SplitString(x,',')\r\n\r\ny1_correct = 'Take that'\r\ny2_correct = ', and this, and something else.'\r\n\r\nassert(isequal(y1,y1_correct))\r\nassert(isequal(y2,y2_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":21274,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":123,"test_suite_updated_at":"2017-05-31T17:36:57.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-12-24T17:05:02.000Z","updated_at":"2026-03-06T21:16:26.000Z","published_at":"2013-12-24T17:32:55.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"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\u003eA simple operation to split a given string into two substrings at the point where the desired character is first found. e.g.\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\u003einputString: 'we have 6 cars' split it from '6'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput: 'we have ' and '6 cars'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf the desired character is not found then first substring is same as the whole string and the second string is empty string, i.e. y2='';\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":2081,"title":"Concatenate strings","description":"concatenate a variable number of input strings to produce one outputstring","description_html":"\u003cp\u003econcatenate a variable number of input strings to produce one outputstring\u003c/p\u003e","function_template":"function y = concatstrings( varargin )\r\n  y = varargin;\r\nend","test_suite":"%%\r\nx1 = 'a';\r\nx2=  'b';\r\ny_correct = 'ab';\r\nassert(isequal(concatstrings(x1,x2),y_correct))\r\n%%\r\nx1 = 'a';\r\nx2=  'b';\r\nx3=  'c';\r\ny_correct = 'abc';\r\nassert(isequal(concatstrings(x1,x2,x3),y_correct))\r\n%%\r\nx1 = 'my';\r\nx2= ' ';\r\nx3=  'holiday';\r\nx4=  ' ';\r\nx5= 'is';\r\nx6= ' almost over!';\r\ny_correct = 'my holiday is almost over!';\r\nassert(isequal(concatstrings(x1,x2,x3,x4,x5,x6),y_correct))\r\n%%\r\nassert(isempty(concatstrings()))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":20079,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":214,"test_suite_updated_at":"2013-12-29T09:49:09.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-12-29T09:39:07.000Z","updated_at":"2026-02-22T02:47:17.000Z","published_at":"2013-12-29T09:49:09.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003econcatenate a variable number of input strings to produce one outputstring\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":2139,"title":"most frequent character","description":"Obtain the most frequent character.\r\nFor example, \r\n\r\n s='balaram';\r\n output='a';\r\n\r\nIf there is a tie between letters, return the first result alphabetically.","description_html":"\u003cp\u003eObtain the most frequent character.\r\nFor example,\u003c/p\u003e\u003cpre\u003e s='balaram';\r\n output='a';\u003c/pre\u003e\u003cp\u003eIf there is a tie between letters, return the first result alphabetically.\u003c/p\u003e","function_template":"function y = frequent_character(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'purusa';\r\ny_correct = 'u';\r\nassert(isequal(frequent_character(x),y_correct))\r\n\r\n%%\r\nx = 'rama';\r\ny_correct = 'a';\r\nassert(isequal(frequent_character(x),y_correct))\r\n\r\n%%\r\nx = 'extemporaneous';\r\ny_correct = 'e';\r\nassert(isequal(frequent_character(x),y_correct))\r\n\r\n%%\r\nx = 'Thisisasentencewrittenasalongwordwithnospaces.';\r\ny_correct = 's';\r\nassert(isequal(frequent_character(x),y_correct))\r\n\r\n%%\r\nx = 'Jabberwocky';\r\ny_correct = 'b';\r\nassert(isequal(frequent_character(x),y_correct))\r\n\r\n%%\r\nx = 'inimical';\r\ny_correct = 'i';\r\nassert(isequal(frequent_character(x),y_correct))\r\n\r\n%%\r\nx = 'nine-million';\r\ny_correct = 'i';\r\nassert(isequal(frequent_character(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":1690,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":173,"test_suite_updated_at":"2017-05-31T17:44:41.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2014-01-31T02:50:53.000Z","updated_at":"2026-02-22T02:52:26.000Z","published_at":"2014-01-31T02:50:53.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\u003eObtain the most frequent character. For 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[ s='balaram';\\n output='a';]]\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\u003eIf there is a tie between letters, return the first result alphabetically.\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":2140,"title":"Alternately upper-lower case","description":"Modify the string to alternate between upper and lower case. For example,\r\n s='achyuta'\r\n output='AcHyUtA'\r\n\r\nUpdate - Test cases added at 09-09-2022","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: 132.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 66.4333px; transform-origin: 407px 66.4333px; 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: 233.5px 8px; transform-origin: 233.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eModify the string to alternate between upper and lower case. For example,\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; 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 20.4333px; transform-origin: 404px 20.4333px; 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: 48px 8.5px; tab-size: 4; transform-origin: 48px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 12px 8.5px; transform-origin: 12px 8.5px; \"\u003e s=\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: 36px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 36px 8.5px; \"\u003e'achyuta'\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: 68px 8.5px; tab-size: 4; transform-origin: 68px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003e output=\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: 36px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 36px 8.5px; \"\u003e'AcHyUtA'\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\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: 131.5px 8px; transform-origin: 131.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eUpdate - Test cases added at 09-09-2022\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = altul(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'gopala';\r\ny_correct = 'GoPaLa';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'adhisesa';\r\ny_correct = 'AdHiSeSa';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'Borderline';\r\ny_correct = 'BoRdErLiNe';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'mAtLaB CoDy';\r\ny_correct = 'MaTlAb cOdY';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'Quadrillion';\r\ny_correct = 'QuAdRiLlIoN';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'i AM batMAN';\r\ny_correct = 'I Am bAtMaN';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'dinnertime';\r\ny_correct = 'DiNnErTiMe';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'bicycle';\r\ny_correct = 'BiCyClE';\r\nassert(isequal(altul(x),y_correct))\r\n%%\r\nx = 'QUADRACEPS';\r\ny_correct = 'QuAdRaCePs';\r\nassert(isequal(altul(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":1690,"edited_by":223089,"edited_at":"2022-09-09T07:55:07.000Z","deleted_by":null,"deleted_at":null,"solvers_count":276,"test_suite_updated_at":"2022-09-09T07:53:39.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2014-01-31T02:58:23.000Z","updated_at":"2026-03-20T04:27:15.000Z","published_at":"2014-01-31T02:58:23.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eModify the string to alternate between upper and lower case. For 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[ s='achyuta'\\n output='AcHyUtA']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eUpdate - Test cases added at 09-09-2022\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\"}]}"}],"no_progress_badge":{"id":53,"name":"Unknown","symbol":"unknown","description":"Partially completed groups","description_html":null,"image_location":"/images/responsive/supporting/matlabcentral/cody/badges/problem_groups_unknown_2.png","bonus":null,"players_count":0,"active":false,"created_by":null,"updated_by":null,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"created_at":"2018-01-10T23:20:29.000Z","updated_at":"2018-01-10T23:20:29.000Z","community_badge_id":null,"award_multiples":false}}