Given a list of US states, remove all the states that end with the letter A.
Input s1 = 'Alabama Montana Nebraska Vermont Nevada';
Output s2 is ' Vermont ';
I believe this problem has the wrong assertion for part 2. The space rule seems to be to keep spaces between words unless it is something like North Dakota in which you delete the space between the two words. Missouri New Hampshire seems to be missing a space, as only 3 are present. With three entries to delete there should be four spaces Missourix1x2x3xNew (4 x's or spaces for 3 matches).
There's an error in the second test case. This is what's returned: "Error: Error: A MATLAB string constant is not terminated properly." I assume this is due to there being an accidental new-line character in the input string.
I've cleaned up the second test. There was a bad character in there somewhere, but it's working now and I've rescored all the answers.
I get the infamous "Remove inappropriate content" message when trying to submit a solution to this problem.
This is a bizarre one - test case is dependent on how many spaces are between the state names, which points to a specific solution having to be used rather than a solution that makes sense to the user.
Additionally, I have noticed a stange effect in 19a when I use "join". My solution has too few spaces between "Delaware" and "Hawaii", so I thought I'd just bung another one in there with "join". If I do:
s2 = cell2mat(join(s2," ")), % I get the same number of spaces
s2 = cell2mat(join(s2," ")) % I get too many spaces!
Driving me wild...
@Kiran Ramsaroop, instructions are to remove state names, not spaces. It may seem silly to want this, but it is accurate.
Thus only spaces that are part of a removed state name should be removed.
Be careful of the 2-word states.
Converting to different formats boggles me
Can you help?
s2 = ' Vermont ';
Here the task is to extract the word but result contained extra spaces????
check your test case with my programme. It passes all test suite case in MATALB 2017b but not passing the test suite here.
Ah - two word states count, like North Dakota.
Is my wife right? Now with even more wrong husband
High school cafeteria
Check if number exists in vector
Return area of square
Remove all the words that end with "ain"
Return the largest number that is adjacent to a zero
Finding Perfect Squares
Return a list sorted by number of occurrences
Most nonzero elements in row
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