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
-
Select every other element of a vector
32988 Solvers
-
Calculate the Levenshtein distance between two strings
1426 Solvers
-
567 Solvers
-
Matrix indexing with two vectors of indices
722 Solvers
-
Find a subset that divides the vector into equal halves
387 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!