Problem 92. Find state names that start with the letter N
Given a list of US states, remove all the states that start with the letter N, leaving surrouding spaces intact. For example:
If
s1 = 'Alabama Montana Nebraska Vermont Nevada';
then
s2 = 'Alabama Montana Vermont ';
Notice that the spaces before and after "Nebraska" in s1 still remain between "Montana" and "Vermont" in s2. The same applies for the space before "Nevada".
Be mindful of two-word states that also start with the letter N, like "New York" or "North Carolina". For example:
If
s1 = 'Alabama Montana New York Vermont';
then
s2 = 'Alabama Montana Vermont';
Notice that the spaces before and after "New York" in s1 still remain between "Montana" and "Vermont" in s2.
Solution Stats
Problem Comments
-
12 Comments
Show
9 older comments
Timea Nagy
on 23 Apr 2022
I think I found a very easy solution.
Peter
on 14 Feb 2023
A waste of time, just as useless as Problem 61 :(
Robert Wagner
on 15 Apr 2024
I hate regexp and they hate me!
Solution Comments
Show commentsGroup

Matrix Manipulation I
- 16 Problems
- 98 Finishers
- Remove the air bubbles
- Remove NaN ?
- N-Dimensional Array Slice
- Back to basics 21 - Matrix replicating
- Back to basics 23 - Triangular matrix
- Make an awesome ramp for a tiny motorcycle stuntman
- Flip the main diagonal of a matrix
- surrounded matrix
- Some Assembly Required
- Set some matrix elements to zero
- Matrix with different incremental runs
- Removing rows from a matrix is easy - but what about inserting rows?
- Rotate input square matrix 90 degrees CCW without rot90
- Permute diagonal and antidiagonal
- Operate on matrices of unequal, yet similar, size
- Reverse the elements of an array
Problem Recent Solvers1286
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!