Problem 66. Find the two-word state names
Given a list of states, remove all the states that have two-word names.
If
s1 = 'Alabama Montana North Carolina Vermont Nevada';
then
s2 = 'Alabama Montana Vermont Nevada';
Solution Stats
Problem Comments
-
14 Comments
The test function has some incorrect values: Nebraska and Nevada are incorrectly removed, Rhode Island, South Carolina, South Dakota and West Virginia are incorrectly left in.
I've fixed the problem and you're now the leader. Sorry about that!
A second test case is needed for this problem. 'New York Nevada' should suffice.
I added another test, similar to the one suggested. Thanks for the comment Richard!
I keep getting 'inappropriate content' errors.
"Remove inappropriate content" error...
What is " two_word name"??
if i would grasp all regexp possibilities in depth.. makes me cry
What do this problem mean ?
@Cody Team, does this need to be a Cody Challenge? It's a pretty rubbish problem
I would vote for removal from this list as well. There is even another one about US states... This is so infuriating and repetitive I almost resorted to echoing assert.
I too would vote for removal from this list.
I can understand strtrim but not that in the solution there must be exactly the same amount of (say) 7 spaces between two consecutive words.
Terrible test cases. Terrible. Lazy and slumpy test cases. Needed to reverse engineer to get the problem done. Test cases need to be adjusted.
Worked first try, size 12, good problem
Solution Comments
Show commentsProblem Recent Solvers1196
Suggested Problems
-
Remove the small words from a list of words.
1495 Solvers
-
Back to basics 8 - Matrix Diagonals
924 Solvers
-
Longest run of consecutive numbers
5588 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
823 Solvers
-
1170 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!