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.
used this code : getting also the coreect and in my PC , but failed here ?? Can anyone help me ??
a=split(s1);
for i=1:length(a)
if (a{i}(1) == 'N' && a{i}(2)== 'e' && a{i}(3)== 'w') || (a{i}(1) == 'N' && a{i}(2)== 'o' && a{i}(3)== 'r' && a{i}(4)== 't' && a{i}(5)== 'h')
a{i} = '0' ;
a{i+1} = '0';
elseif a{i}(1) == 'N'
a{i} = '0' ;
end
end
str = (string(a));
str(find(str=='0'))='';
s2 = char(join(str))
No matter what I do the assertion fails. I have tried three different solutions and for all I get the same result even though I get the correct answer in my computer. Can someone help!!! thanks!
this uses very simple expression
Vectorize the digits of an Integer
269 Solvers
367 Solvers
464 Solvers
1077 Solvers
2924 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!