I really like this problem. So far, this is the one I had to think about most. Mostly because the straight-forward recursive implementation is simply not feasible for longer inputs.
Go back to school!
Shameless code... now i'll do that in right way.
The simplest solution for beginner, now I'm trying to solve in a correct way
Apparently the test suite needs to be augmented!
Done. People never get tired of look-up tables.
Indeed: all of the current supposedly 'top ten' submissions here (by Cody-size) are hard-coded hacks! The Test Suite can be augmented by: (i) adding more arbitrary test cases; (ii) adding test cases in which the first [and last] characters/words are the same as in some other test case(s); (iii) banning mention of numbers that correspond to results and need not be mentioned in legitimate submissions (e.g. 18, 25, 27) [as implemented for Problem 44466]; and (iv) potentially banning other key words appearing in other 'generic' hacks (per Solutions 312146 and 1039520). —DIV
Back and Forth Rows
Summing Digits within Text
Given two strings, find the maximum overlap
Reverse the elements of an array
Fahrenheit to Celsius converter
Sums with Excluded Digits
Find all elements less than 0 or greater than 10 and replace them with NaN
Renaming a field in a structure array
Knight's Tour Checker
It dseon't mettar waht oedrr the lrettes in a wrod are.
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office