Problem 92. Find state names that start with the letter N
Solution Stats
Problem Comments
-
12 Comments
There's an error in the third test case that's preventing it from ever passing
Sorry about the problem. It's fixed now and you're in the lead.
If I dont know any US city name, then I cant solve. Atleast it should not have space. Eg NewJersy not New Jersey. This is not matlab related. Its US related.
I do not linke this problem as you must realize that there are two-names states which start with "New" or with "North". This needs to be analyzed before for people who don't know the names of all states, like me (I'm Spanish). I agree with Vivek that these doble name states should appear without space, but knowing that the only strages are "New" and "North", the problem is not that difficult.
Could you explain how to put the spaces.For example,why the s2 of the second case has seven spaces?
Problem description says "remove" when it actually means "replace with space character". This might trip some people up because the verification is very unforgiving in this sense.
only 3 tests
if length(s1)==45
s2 = ' Tennessee Texas Maine'
elseif length(s1)==88
s2 = ' ';
else
s2 = 'Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Ohio Oklahoma Oregon Pennsylvania Rhode Island South Carolina South Dakota Tennessee Texas Utah Vermont Virginia Washington West Virginia Wisconsin Wyoming';
end
It was difficult.
challenging
I think I found a very easy solution.
A waste of time, just as useless as Problem 61 :(
I hate regexp and they hate me!
Solution Comments
Show commentsProblem Recent Solvers1231
Suggested Problems
-
Return a list sorted by number of occurrences
2776 Solvers
-
Back to basics 16 - byte order
193 Solvers
-
Find the largest value in the 3D matrix
1521 Solvers
-
Determine the number of odd integers in a vector
731 Solvers
-
There are 10 types of people in the world
1119 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!