Put more test cases in. Makes cheating too tempting.
the regexp solution is great
Adding a test case containing words with hyphens like 'hard-working' will make this problem more challenging.
Test 1 doesn't work, I literally have the same result and it fails, but test 2 passes
Your function produces sOut in string format (in the last line of the function). The test suite defines the variables as character arrays instead of strings. These two data types cannot be directly compared—i.e., you'll have to return a character array.
Also, when I run your function, it returns "hello" rather than "hlleo".
I've tried the assert in MATLAB on my desktop and it doesn't throw an error... so I'm not really sure where it's gone wrong here. I'm guessing it's something tiny I've missed. Any help?
Which version of MATLAB are you using on your desktop? I tried running your solution on MATLAB desktop version 2019a and the solution is failing with correct assertions. In order to figure out the version of MATLAB, command "ver' will get you the version.
The version of matlab is not going to affect the result. This solution removes punctuation from the input, so the '.' at the end of sentence in the second test is incorrectly removed.
Couldn't work out how to leave the punctuation in :(
The test suite should add commas and other punctuation.
Sum of first n terms of a harmonic progression
Convert from Base 10 to base 5
Given a window, how many subsets of a vector sum positive
Create a vector whose elements depend on the previous element
Generate a NaN...on purpose
Find relatively common elements in matrix rows
What is the next step in Conway's Life?
Find the palindrome
Find state names that end with the letter A
Find the peak 3n+1 sequence value
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